Skip to content

Instantly share code, notes, and snippets.

View memoryleak's full-sized avatar

Haydar Ciftci memoryleak

View GitHub Profile
@memoryleak
memoryleak / _mydata.sql
Last active September 30, 2015 18:38
create trigger syntax
CREATE TABLE `_mydata` (
`id` int(10) unsigned NOT NULL,
`version` int(10) unsigned NOT NULL,
`creation` datetime DEFAULT NULL,
`data` varchar(100) DEFAULT NULL,
`action` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`,`version`),
UNIQUE KEY `id_version` (`id`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
monolog:
handlers:
main:
type: stream
path: %kernel.root_dir%/../../logs/%kernel.environment%.log
level: debug
firephp:
type: firephp
level: info
#!/bin/bash
filename=$(basename "$1")
sips -z 64 64 $1 --out /res/drawable-xhdpi/$filename
sips -z 45 45 $1 --out /res/drawable-hdpi/$filename
sips -z 32 32 $1 --out /res/drawable-mdpi/$filename
sips -z 16 16 $1 --out /res/drawable-ldpi/$filename
@memoryleak
memoryleak / locales.txt
Last active December 22, 2015 14:18
Locale variables for system sertup
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
LC_ADDRESS="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
#!/bin/bash
brew install freetype libjpg libpng pcre icu4c autoconf
sudo ln -s /usr/local/Cellar/icu4c/51.1/bin/icu-config /usr/bin/icu-config
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
@memoryleak
memoryleak / dbie.sh
Created April 14, 2014 07:37
MySQL import & export
#!/bin/bash
ACTION=$1
DATABASE_NAME=$2
SQL_FILE=$3
if [[ "$ACTION" == "import" ]]; then
if [[ -f "$SQL_FILE" ]]; then
# Drop existing database
echo -n "Dropping ${DATABASE_NAME}..."
#!/bin/bash
TODAY="*$(date +%A)*"
WORKDAYS="Monday Tuesday Wednesday Thursday Friday"
SCREENSHOT_PATH="$HOME/Pictures/Screenshots/$(date +%Y)/$(date +%B)/$(date +%A)"
if [[ ! -d $SCREENSHOT_PATH ]]
then
mkdir -p $SCREENSHOT_PATH
fi
@memoryleak
memoryleak / portrange.sh
Last active August 29, 2015 14:15
Port Range extender
#/bin/bash
sudo sh -c 'echo "1024 65000" > /proc/sys/net/ipv4/ip_local_port_range'
@memoryleak
memoryleak / product.phtml
Created February 18, 2015 13:44
Product Group Limits for Magento
<script type="text/javascript">
jQuery(document).ready(function() {
var maxHeight = <?php echo intval($_product->getMaxHeight()); ?>;
jQuery('.qty').change(function(){
var currentHeight = 0;
jQuery('.qty').each(function(index) {
var height = parseInt(jQuery(this).attr('data-height'));
var qty = parseInt(jQuery(this).val());
#!/bin/bash
BREAK="===============================================================";echo -ne "\n $BREAK \n \t Disk Usage for $(pwd) $(date +'%F') \n $BREAK \n\n";df -h $(pwd); echo -e '\n\n Volume Group Usage: \n'; vgs $(df -h $(pwd) | grep dev | awk '{print $1}'| cut -d\- -f1| cut -d\/ -f4); echo -e '\n'; echo -e "Largest Folders:\n"; du -xSk $(pwd) | sort -rn | head -30|awk '{printf "%d MB\t%s\n",($1/1024),$NF}' && echo -e "\n\n"; echo -e "Largest Files:\n"; find $(pwd) -mount -type f -ls|sort -rnk7 |head -30|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}';echo -e "\n\n Open Deleted Files:\n" ;lsof | grep $(pwd) | grep deleted| awk '{ if($7 > 1048576) print $7/1048576, "MB ",$9,$1 }' | sort -n -u | tail; echo -e "\n $BREAK"