Sign up to create your own snipts, or login.

Public snipts » tayhimself's snipts The latest snipts from tayhimself.

showing 1-20 of 52 snipts
  • 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
  • symfony pear installation and upgrade
    $ pear channel-discover pear.symfony-project.com
    # to only upgrade the pear channels and not the symfony channel
    $ sudo pear update-channels
    $ sudo pear upgrade pear
    # to upgrade the symfony channel to the latest 1.2 version
    # a pear upgrade-all would get symfony 1.4
    $ sudo pear upgrade symfony/symfony-1.2.10
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Dec 01, 2009 at 6:32 p.m. EST
  • mysql get most recent item
    SELECT STATUS , COUNT( * )
    FROM (SELECT subject_id, max( created_at ) AS date
    FROM study_status GROUP BY subject_id) AS x
    INNER JOIN study_status s ON ( s.subject_id = x.subject_id
    AND s.created_at = x.date )
    GROUP BY STATUS
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 24, 2009 at 11:46 a.m. EST
  • mysql show processlist
    show processlist;
    show processlist\G;
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 10, 2009 at 8:29 p.m. EST
  • Create symfony guard user
    $ symfony guard:create-user --application=frontend jon SoMePasSwOrD
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 10, 2009 at 10:52 a.m. EST
  • Fix non sleep aware modules
    # echo 'SUSPEND_MODULES="$SUSPEND_MODULES edimax-driver-name-here' > /etc/pm/config.d/edimax-fix
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 04, 2009 at 4:49 p.m. EST
  • burn cd and dvd's in ubuntu
    #make the image
    $ mkisofs -r -J -o yourbackup.iso /home/path_to/your_files
    #record the image
    $ cdrecord -v dev=/dev/cdrw --speed=24 -data dfdsdf-02Nov.iso
    
    #make an image from a video dvd
    cat /dev/scd0 > ./orange_county_fl_video.iso
    #burn dvd
    $ growisofs -dvd-compat -speed=12 -Z /dev/dvdrw -joliet-long -R -V "myVolume" <filename>
    $ growisofs -Z /dev/dvdrw -R -J /some/files
    #can also use cdrecord to burn dvds
    $ cdrecord -v dev=/dev/cdrw --speed=24 -data dfdsdf-02Nov.iso
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Nov 03, 2009 at 6:41 p.m. EST
  • php conditional shorthand
    //B.//asic True / False Declaration
    $is_admin = ($user['permissions'] == 'admin' ? true : false);
    
    //Conditional Welcome Message
    echo 'Welcome '.($user['is_logged_in'] ? $user['first_name'] : 'Guest').'!';
    
    //Conditional Items Message
    echo 'Your cart contains '.$num_items.' item'.($num_items != 1 ? 's' : '').'.';
    
    
    //Conditional Basepath
    echo '<base href="http'.($PAGE_IS_SECURE ? 's' : '').'://mydomain.com" />';
    
    //Nested PHP Shorthand
    echo 'Your score is:  '.($score > 10 ? ($age > 10 ? 'Average' : 'Exceptional') : ($age > 10 ? 'Horrible' : 'Average') );
    
    //Leap Year Check
    $is_leap_year = ((($year % 4) == 0) && ((($year % 100) != 0) || (($year %400) == 0)));
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Oct 26, 2009 at 7:37 p.m. EDT
  • Dump all tables in a mysql database
    #!/bin/sh
    #This scripts returns commands for dumping all the tables in a database
    #Then you can zip or cat the txt files
    
    all_tables=$(mysqlshow -u root -p8l3nxiam dsm_dev | \
    awk '{ if (NR >4 ) print $_}' | \
    sed -e 's/[|+-]//g; /^$/d ' | \
    xargs )
    #echo ${all_tables};
    for TABLE in ${all_tables}; do
    echo mysqlshow -uroot -p8l3nxiam dsm_dev $TABLE % \> $TABLE.txt
    #$(mysqlshow -uroot -p8l3nxiam dsm_dev $TABLE \%)
    #echo $TABLE
    done
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Oct 26, 2009 at 7:26 p.m. EDT
  • find and xargs with spaces
    $find . -type f -print0 | xargs -0 wc -l
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Oct 23, 2009 at 7:02 p.m. EDT
  • Sed search replace
    #replace 999 with nothing
    sed 's/999//g' output.csv > output-no999.csv
    
    #awk print a particular column
    awk '{print $1"\t"$2}' file.csv
    

    copy | embed

    0 comments - tagged in  posted by tayhimself on Oct 22, 2009 at 3:49 p.m. EDT
Sign up to create your own snipts, or login.