IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » development The latest public development snipts.

showing 1-7 of 7 snipts for development
  • svn ignore passwords
    # on production servers its often a good idea not to store svn passwords.
    # heres a one-liner to do just that:
    echo "store-passwords=no" >> ~/.subversion/servers && rm -f ~/.subversion/auth/svn.simple/*
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Aug 11, 2010 at 6:14 p.m. EDT
  • prevent dot underscore mac os x tar
    # prevent tar from creating those blasted 
    # dot-underscore (aka ._) alias 'Apple Double'  files.
    # put this in your .bashrc file.
    
    export COPYFILE_DISABLE=true
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Apr 09, 2010 at 7:30 p.m. EDT
  • remove .svn folders
    find . -name ".svn" -type d -exec rm -rf {} \;
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Jan 06, 2010 at 11:47 a.m. EST
  • outdated drupal module with svn
    ## In a nutshell, how to update a module from Drupal contrib, 
    ## on a production site that is under revision control (subversion).
    
    # If you turn on a module (that just happens to already be
    # present in the list on admin/build/modules), then you MUST
    # 1)  go to the update status page
    # 2)  find out if the module you just turned on is up to date
    # 3)  if it is,  fine (your done! stop here),  
    # 4)  if there are updates... then go to the drupal.org site first
    #     to see if there are any "gotchas" for the upgrade.  As you'll
    #     be turning the module on for the first time on a new site,
    #     then you shouldnt have to worry too much.
    # 5)  To run the updates: login via ssh
    
    ssh username@server.com
    
    # 6) go to the right folder and execute drush update
    
    cd domains/example.com/public_html/sites/all/modules
    drush --uri=example.com update modulename
    
    # 7) confirm that the update was successful on the site
    # 8) then check in the code
    
    svn commit -u username -m "updated modulename to the latest version"
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Dec 23, 2009 at 4:49 p.m. EST
  • update drupal from subversion tags
    # Update a Drupal minor revision using a patch file.
    # Creating a patch file between cvs tags on the server proved to be 
    # impossible. I've found a way to do this with a subversion mirror
    # of Drupal core.
    
    cd ~/path/to/local/drupal
    
    # What is current version of Drupal?
    cat CHANGELOG.txt | grep Drupal | head -1
    ## Drupal 6.13, 2009-07-01
    
    # I'm using a Subversion mirror of Drupal core to create the patch.
    # (Thanks to the guys at subversible.com!)
    svn diff http://subversible.com/svn/drupal/tags/DRUPAL-6-13 \ 
             http://subversible.com/svn/drupal/tags/DRUPAL-6-14 > d6-14.patch 
    
    # The local version of drupal was created from a tarball, and the date 
    # format inside the $Id$ (from CVS) is: YYYY/mm/dd HH:MM:SS,  but in the 
    # subversion patch it was YYYY-mm-dd HH:MM:SS.  So I had to this quick 
    # find/replace in order to get the patch to apply cleanly.
    perl -pi -e 's/(\d{4})-(\d{2})-(\d{2})\s(\d{2})/\1\/\2\/\3 \4/g' d6-14.patch
    
    
    # Check to see if you have any outstanding uncommitted local changes. If
    # there are some changes then execute the commit (commented out below).
    svn status
    #svn commit -m "latest changes prior to drupal core update"
    
    # Apply the patch.  The patch from svn diff command should be in 
    # unified diff format (-u) and the paths should be taken as they are so 
    # files in subfolders are matched (-p0).
    patch -p0 -u <d6-14.patch
    
    
    #dont forget to commit the updates...
    svn commit -m "updated core drupal"
    
    #optionally, tag the updated code in the repository
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Dec 11, 2009 at 7:45 p.m. EST
  • mac os x apache development setup
    ##
    ##  This will setup a fresh install of Mac OS X up for AUTOMATICALLY serving
    ##  custom top level domains (such as .dev or .test) for your development 
    ##  environment on a MacBook Pro laptop.  You no longer have to muck with adding
    ##  VirtualHosts  or editing /etc/hosts files, and you definitely dont need 
    ##  to download MAMP.
    ##
    ##  I recommend executing commands below by hand. 
    ##
    ##  After completion of all the commands, add  ""127.0.0.1""  (without quotes)
    ##  to the top of the list of DNS servers in:
    ##    
    ##     System Preferences > Network > Advanced... > DNS tab > DNS Servers
    ##
    ##  The directory structure of your ~/Sites folder should be the following: 
    ##   ~/Sites
    ##     |- dev
    ##     |  |- project1
    ##     |  |  |- public
    ##     |  |  |  |- index.html
    ##     |  |  |  |- otherpage.html
    ##     |  |- subdomainswork.project2
    ##     |  |  |- public
    ##     |  |  |  |- index.html
    ##
    ##  The BIND / Apache configurations explained below combined with the above 
    ##  example folder structure would enable the following:
    ##
    ##   http://localhost/                
    ##          <--- /Users/username/Sites/ 
    ##   http://project1.dev/             
    ##          <--- /Users/username/Sites/dev/project1/public/
    ##   http://subdomainswork.project2.dev/
    ##          <--- /Users/username/Sites/dev/SubDomainsWork.Project2/public/
    ##
    ##  The code here is a summarized version of the instructions and comments in a 
    ##  blog entry by Jason Johnoson of postpostmodern.com, originally posted here:
    ##
    ##     http://postpostmodern.com/instructional/a-smarter-mamp/ 
    ##
    
    
    E_BADARGS=85
    if [ -z "$1" ]
    then
      echo "Usage: `basename $0` tld"
      exit $E_BADARGS
    fi
    
    # edit the following as desired, if running this by hand
    USERNAME=`whoami`
    TLD=$1
    
    # The file needs to be ran as your regular Mac OS X user, not root.
    if [[ `whoami` = "root" ]] 
    then
     echo "Please execute this script as an admin user, do not use the sudo command."
     echo "Usage: `basename $0` tld"
     exit 0
    fi
    
    
    
    ############################
    ##   BIND Configurations  ##
    ############################
    
    # Create a custom launch key for BIND
    if [ ! -e /etc/rndc.conf ]
    then 
      echo "Creating RNDC"
      sudo rndc-confgen > /etc/rndc.conf
      sudo head -n 6 /etc/rndc.conf > /etc/rndc.key
    fi
    
    
    if [ ! -e /var/named/$TLD.zone ]
    then
      # Add the top level domain to BIND.
      echo "Adding TLD '$TLD' to BIND"
      sudo chmod 777 /etc/named.conf
      cat >> /etc/named.conf <<END
    zone "$TLD" IN {
      type master;
      file "$TLD.zone";
    };
    END
      # Create the Zone file for BIND
      echo "Creating zone file for $TLD (/var/named/$TLD.zone)"
      sudo chmod 644 /etc/named.conf
      sudo touch /var/named/$TLD.zone
      sudo chmod 777 /var/named/$TLD.zone
      cat > /var/named/$TLD.zone <<END
    ;
    ; BIND data file for $TLD sites
    ;
    \$TTL    604800
    @       IN      SOA     $TLD. root.$TLD. (
                         2008101920         ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
    @       IN      NS      $TLD.
    @       IN      A       127.0.0.1
    *.$TLD.  14400   IN      A       127.0.0.1
    END
    fi
      sudo chmod 644 /var/named/$TLD.zone
    
    # Allow named daemon to be launched on boot. 
    if [[ `sudo defaults read /System/Library/LaunchDaemons/org.isc.named Disabled` = 1 ]]
    then 
      echo "Configuring BIND LaunchDaemon"
      # Unfortunately this will convert the plist from XML to binary format! 
      sudo defaults write /System/Library/LaunchDaemons/org.isc.named Disabled -boolean true
      # here's an alternate  that maintains the file in human-readable text format.
      # sed -n 5,6s/<true/<false/  /System/Library/LaunchDaemons/org.isc.named.plist
    fi
    # Load/Reload BIND
    sudo launchctl load /System/Library/LaunchDaemons/org.isc.named.plist
    
    
    ###############################
    ##  Bonjour Configurations   ##
    ###############################
    
    
    if [ ! -e /etc/resolver/$TLD ]
    then
      echo "Creating top level domain entry in Bonjour for '$TLD'"
      if [ ! -d /etc/resolver ] ; then sudo mkdir /etc/resolver ; fi
      # Enable Bonjour to serve your top level domain when you aren't connected to the internet
      sudo chmod 777 /etc/resolver
      cat > /etc/resolver/$TLD <<END
    domain $TLD
    nameserver 127.0.0.1
    END
    fi
      sudo chmod 755 /etc/resolver
      
    ###############################
    ##  TLD VirtualHost Folder   ##
    ###############################
    
    if [ ! -e "/Users/$USERNAME/Sites/$TLD" ]
    then
       echo "Creating ~/Sites/$TLD folder for user $USERNAME"
       mkdir -p "/Users/$USERNAME/Sites/$TLD"
    else
       echo "~/Sites/$TLD exists."
    fi
    
    ###############################
    ##  Apache Configurations    ##
    ###############################
    
    # create a new apache configuration for your user.
    echo "Updating Apache config /etc/apache2/users/$USERNAME.conf for NameVirtualHost mode."
    sudo mv /etc/apache2/users/$USERNAME.conf /etc/apache2/users/$USERNAME.conf.`date "+%Y%m%d%H%M%S"`
    sudo chmod 777 /etc/apache2/users
    cat > /etc/apache2/users/$USERNAME.conf <<END
    DocumentRoot /Users/$USERNAME/Sites
    <Directory "/Users/$USERNAME/Sites/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
        VirtualDocumentRoot /Users/$USERNAME/Sites/%-1/%-2+/public
    </VirtualHost>
    END
    sudo chmod 755 /etc/apache2/users
    
    # restart apache, You may wan to check in the Console.app for any apache errors.
    echo "Restarting Apache."
    sudo apachectl restart
    
    
    # Dont forget to add 127.0.0.1 to the list of DNS servers in System Preferences  (see above).
    # You'll also need to add probably some other DNS entries as well. I recommend OpenDNS.
    

    copy | embed

    2 comments - tagged in  posted by jrguitar21 on Nov 09, 2009 at 2:56 a.m. EST
  • Some GIT setup commands I used...
    # Some git/github snippets.
    # My user is swbratcher, so replace it with your own...
    # The user is 'user' so replace it with the username...
    # Is git installed?...
    which git
    #
    # If no, install git...
    # download it from the web. then change to the unarchived directory...
    cd /Users/scott/Desktop/git-1.*
    # run make, make install...
    make
    # ...
    make install
    # ... then optionally...
    make clean
    # ...to clean up.
    #
    # Change to the directory where your projects are stored...
    cd /Working/projects/
    # Copy your public key for the github user setup...
    cat ~/.ssh/id_rsa.pub | pbcopy
    # ...if that didn't copy anything to your clipboard, run this...
    ssh-keygen  # ...and hit return until complete...
    # ...then try again.
    # ...if it still doesn't work, google is your friend, sorry for no more help.
    #
    #
    # Now, test your ssh auth setup...
    ssh git@github.com
    # Clone your project fork from your account.
    # Get this url on the github page...
    git clone git@github.com:swbratcher/project.git
    # 
    # Add the forks of your collaborators. This for each team member...
    git remote add user git@github.com:user/project.git
    # Keep in mind if you pull their code before they say it's ready, 
    # you'll probably break.
    # Now if you are ready to download the files in that repo, go...
    git pull user master
    # view your fork in the built-in GIT GUI...
    git gui
    
    #
    

    copy | embed

    0 comments - tagged in  posted by swbratcher on Apr 07, 2009 at 9:11 p.m. EDT
Sign up to create your own snipts, or login.