This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('CONS_KEY', 'Application consumer key'); | |
| define('CONS_SECRET', 'Application consumer secret'); | |
| require_once __DIR__.'/silex.phar'; | |
| $app = new Silex\Application(); | |
| // register the session extension | |
| $app->register(new Silex\Extension\SessionExtension()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 | |
| # sudo /sbin/mkswap /var/swap.1 | |
| # sudo /sbin/swapon /var/swap.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Install and enable ACL | |
| First you need to install ACL, preferrably through your package manager; aptitude on Ubuntu, pacman on Arch, yum on Fedora, etc: | |
| $ sudo aptitude install acl | |
| Then you edit your /etc/fstab to enable ACL for your partition. Simply add acl to the list of options. | |
| /dev/sda1 / ext4 rw,auto,acl 0 1 | |
| Then lastly remount the partition to have the new options take effect. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql -u -p --xml -e 'SELECT * FROM foo WHERE bar="law"' > dump.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysqldump --single-transaction -uUSERNAME -p DBNAME > dump.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| now=$(date +"%Y%m%d_%H%M%S") | |
| if [[ $1 == "" ]] | |
| then | |
| echo "You need to specify the directory you need to backup: bkup PROJECT" | |
| else | |
| dir="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To terminate user sessions or queries on DB instances, Amazon RDS provides the following commands: | |
| PROMPT> CALL mysql.rds_kill(thread-ID) | |
| PROMPT> CALL mysql.rds_kill_query(thread-ID) | |
| For example, to kill the session that is running on thread 99, you would type the following: | |
| PROMPT> CALL mysql.rds_kill(99); | |
| To kill the query that is running on thread 99, you would type the following: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I had an issue with VB/Vagrant today. Here's the error, and the fix: | |
| There was an error while executing `VBoxManage`, a CLI used by Vagrant | |
| for controlling VirtualBox. The command and stderr is shown below. | |
| Command: ["hostonlyif", "create"] | |
| Stderr: 0%... | |
| Progress state: NS_ERROR_FAILURE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| awk '{ sum += $1 } END { print sum }' file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo find /var/log -type f -name "*.gz" -delete |
OlderNewer