Latest 100 public snipts »
tayhimself's
snipts
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
-
∞ 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
-
∞ Delete first line in sed
$ sed '1d' data.file > mynewdata.file
-
∞ 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. -
∞ RHEL tips
# Apache restart /sbin/service httpd restart # Apapche log /var/log/httpd/error_log # svn editor export SVN_EDITOR=vim
-
∞ Symfony cookies
#in factories.yml under the section all add storage: class: sfSessionStorage param: session_name: cookieName
-
∞ rdiff-backup examples
$ rdiff-backup --remove-older-than 3M --force /root/standalone -
∞ 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 {} \;
-
∞ 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(); } ?>
-
∞ 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
-
∞ Freeze project
# To freeze a symfony 1.2 project $ rm web/sf $ symfony project:freeze /usr/share/php/symfony
-
∞ 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
-
∞ 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>
-
∞ 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
-
∞ 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
-
∞ 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.
-
∞ 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(); }
-
∞ osx force eject
$ drutil tray eject -
∞ 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)
-
∞ symfony project generation
$ symfony generate:project iom $ php syfony generate:app --escaping-strategy=on --csrf-secret=iomsurvey survey


