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 » tayhimself's snipts The latest snipts from tayhimself.

showing 1-20 of 62 snipts
  • MySQL update set
    UPDATE tblTransaction AS t LEFT JOIN tblEmployee as e
    ON e.emp_id = t.emp_id SET t.emp_block = e.emp_block 
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Aug 18, 2010 at 9:45 a.m. EDT
  • Batch compile latex files
    $ find . -name '*.tex' -print | while read file; do latex $file;done
    $ find . -name '*.dvi' -print | while read file; do dvipdfmx $file;done
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Aug 16, 2010 at 2:40 p.m. EDT
  • Delete first line in sed
    $ sed '1d' data.file > mynewdata.file
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Aug 11, 2010 at 3:48 p.m. EDT
  • HD spin down fixes
       1. Do not wake up the drives unnecessarily every 10 to 30 seconds or so, thereby gaining substantial power savings and eliminating excess activity. Increasing logging to every 2 minutes would result in 525,600 minutes per year or 262,800 cycles per year. Increase to 5 minutes and cycles would not even be a factor.
    
          a. Linux users: Decrease the logging message
              i. Examine your /etc/syslog.conf file for unnecessary logging activity and to optimize its performance. If you don't want to log any system activity, consider disabling syslogd and klogd entirely; or, at the very least, minimize the amount of logging your system performs. You can also prefix each entry with the minus sign (-) to omit syncing the file after each log entry. This will log anything with a priority of info or higher, but lower than warning, to /var/log/messages or /var/log/mail without needing to sync to disk after each write. Since we want to keep all messages with a priority of warning, this will be logged to a different file without disabling disk syncing (to prevent data loss in the event of a system crash).
    
                 1. *.warning /var/log/syslog
    
                 2. *.info;*.!warning;mail.none -/var/log/messages
    
                 3. mail.info;mail.!warning -/var/log/mail
    
              ii. Another item to be aware of is the -- MARK -- messages that syslogd(8) writes. This will affect your hard drive inactivity settings. You can simply disable this by running syslogd(8) with:
                 1. if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then
                 2. # '-m 0' disabled 'MARK' messages
                 3. /usr/sbin/syslogd -m 0
                 4. sleep 1
                 5. # '-c 3' displays errors on console
                 6. # '-x' turns off broken EIP translation
                 7. /usr/sbin/klogd -c 3 -x
                 8. fi
          b. Modify OS power management timers in control panel
    
       2. Disable Advanced power management using standard ATA command (Uses more power as turns off all low power modes but results in no load/unload cycles)
             1. Linux users add following (hdparm -B 255 /dev/sdX where X is your hard drive device). ATA users can disable APM usually controlled via BIOS and/or OS.
       3. Set Idle3 to max time (effectively turns off load/unload power saving feature thus will use more power) per below link.
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Aug 11, 2010 at 12:42 p.m. EDT
  • RHEL tips
    # Apache restart
    /sbin/service httpd restart
    # Apapche log 
    /var/log/httpd/error_log
    
    # svn editor
    export SVN_EDITOR=vim
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Jul 20, 2010 at 10:45 a.m. EDT
  • Symfony cookies
    #in factories.yml under the section all add 
     storage: 
        class: sfSessionStorage 
        param: 
          session_name: cookieName
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Jun 01, 2010 at 12:33 p.m. EDT
  • rdiff-backup examples
    $ rdiff-backup --remove-older-than 3M --force  /root/standalone
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Apr 13, 2010 at 4:51 p.m. EDT
  • svn quickies
    # recursive add
    $ svn status | grep "^\?" | awk '{print $2}' | xargs svn add
    
    #svn revert accidental rm
    $ svn revert --recursive example_folder
    
    #svn export a repository from one location to another
    $ svn export -r <release> PathOfSvnCheckOut NewPath
    
    # remove all .svn files and folders from a tree
    find . -name ".svn" -exec rm -rf {} \;
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Apr 12, 2010 at 6:17 p.m. EDT
  • symfony global errors
    <?php 
    $num_errores_totales = count($form->getErrorSchema()->getErrors());
    $num_errores_globales = count($form->getErrorSchema()->getGlobalErrors());
    if (0 == $num_errores_totales - $num_errores_globales){
            echo $form->renderGlobalErrors();
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Apr 01, 2010 at 10:11 a.m. EDT
  • Start coding project
    $ mysqladmin -uroot -p create ashq
    $ php symfony configure:database "mysql:host=localhost;dbname=ashq" sqadri myPasswd
    $ php symfony propel:build-all
    
    $ php symfony propel:generate-module survey map MAP
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Mar 19, 2010 at 5:41 p.m. EDT
  • Freeze project
    # To freeze a symfony 1.2 project
    $ rm web/sf
    $ symfony project:freeze /usr/share/php/symfony
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Mar 15, 2010 at 8:27 p.m. EDT
  • sql insert into syntax
    INSERT INTO  physiologic_monitoring  (subject_id) SELECT id FROM subject id JOIN pm_participants p USING (email)
    
    UPDATE participant_summary p  JOIN SSSSSS s USING (participant_id)  SET p.RDI= s.RDI
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Jan 28, 2010 at 4:40 p.m. EST
  • ie colspan bug
    <style type="text/css">
    .colspan {
      width: auto;
    }
    </style>
    ....
    <td colspan="n" class="colspan">...</td>
    
    <!-- or -->
    <td colspan="n" style="width: auto;">...</td>
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Jan 21, 2010 at 3:13 p.m. EST
  • Nahomail & swiftmailer
    #nahomail
    $ symfony plugin-upgrade nahomailplugin
    
    # From http://pear.swiftmailer.org/
    $ sudo pear channel-discover pear.swiftmailer.org
    $ sudo pear remote-list -c swift
    $ sudo pear install swift/swift-4.0.5
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Jan 11, 2010 at 2:45 p.m. EST
  • windows shares credentials
    # delete all shares
    net use * /delete /yes
    
    # get rid of the credentials for a specific share:
    
    net use \\YOUR-SHARE-LOCATION /delete /yes
    
    #get rid of the credentials for the “Code” share on my NAS:
    net use \\ETHERNET_BD\Code /delete /yes
    
    # to map the share to a drive and give it the credentials YOU want Windows to use, go with:
    
    net use DRIVE-LETTER: \\YOUR-SHARE-LOCATION NAS-USER-PASSWORD /user:NAS-USER-NAME
    
    # to map the Code share of my NAS to the Z: drive, and access it with a user called bob who has a password MyClevahPass123, I’d use:
    
    net use Z: \\ETHERNET_BD\Code MyClevahPass123 /user:bob
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 17, 2009 at 2:13 p.m. EST
  • Outlook junk email avoidance tips
    /* Outlook junk email avoidance tips*/
    I don't know which criteria it checks against but it is a combination of
    factors like;
    -what's in the header
    -IP-address
    -computational puzzle
    -spf DNS-record
    -size
    -amount of links
    -amount of words
    -amount of embedded objects
    -certain words
    -etc...
    
    Validity of the addresses in From is not as important. It's more about which
    address is placed in the To line. If that's not the same as the receiver, in
    most cases it will be marked as junk.
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 13, 2009 at 6:44 p.m. EST
  • outlook format fixing
    /* Adding a tab character to the end of the line also prevents the auto-format */private static String FormatEmailBody(String body) {
    
       StringBuilder newText = new StringBuilder();
    
       //two spaces at start of line makes Outlook not remove extra line breaks
    
       newText.Append(" ");
    
       newText.Append(body.Replace(Environment.NewLine, Environment.NewLine+" "));
    
       return newText.ToString();
    
    }
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 13, 2009 at 6:43 p.m. EST
  • osx force eject
    $ drutil tray eject
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 04, 2009 at 7:03 p.m. EST
  • Mysql create MD5 hash and limit it to 16 chars
    UPDATE director SET login_hash=substr(md5(concat(name_full,email,speciality,personal_id)),1,16)
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 04, 2009 at 1:30 p.m. EST
  • symfony project generation
    $ symfony generate:project iom
    $ php syfony generate:app --escaping-strategy=on --csrf-secret=iomsurvey survey
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 04, 2009 at 1:27 p.m. EST
Sign up to create your own snipts, or login.