Skip to content

Instantly share code, notes, and snippets.

View memoryleak's full-sized avatar

Haydar Ciftci memoryleak

View GitHub Profile
#!/usr/bin/env python3
import argparse
from concurrent import futures
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from ftplib import FTP
import os
import random
import string
@memoryleak
memoryleak / launcher.py
Created February 25, 2015 13:10
Because xargs stops working if a process exits with an error I've wrote this small script. It takes a command and launches it with each parameter provided in the --params argument.
#!/usr/bin/env python3
import argparse
from concurrent import futures
from concurrent.futures import ThreadPoolExecutor
import subprocess
parser = argparse.ArgumentParser(description='Stress test a FTP server')
parser.add_argument('-t', '--t', type=int, dest="threads", default=2, help="Number of threads to launch")
parser.add_argument('-c', '--command', dest="command", help="The command to be executed by the threads", required=True)
@memoryleak
memoryleak / .bash_profile
Last active August 29, 2015 14:17
Vim configuration file
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ll='ls -laF --color=auto'
alias ls='ls -F --color=auto'
@memoryleak
memoryleak / sysbench.sh
Created March 24, 2015 14:40
Bash script for system test
#!/bin/bash
cd /data/tmp
sysbench --test=cpu --cpu-max-prime=20000 run
sysbench --test=fileio --file-total-size=20G prepare
sysbench --test=fileio --file-total-size=20G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
sysbench --test=fileio --file-total-size=20G cleanup
sysbench --test=memory run --memory-total-size=2G
sysbench --test=memory run --memory-total-size=2G --memory-oper=read
<?php
require_once 'abstract.php';
class Nudorm_Shell_Category extends Mage_Shell_Abstract
{
/**
* Run script
*
*/
public function run()
@memoryleak
memoryleak / solr.xml
Last active August 29, 2015 14:20
Old Solr Configuration
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/opt/apache-solr-3.5.0/dist/apache-solr-3.5.0.war" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/opt/apache-tomcat-7.0.61/solr" override="true"/>
</Context>
@memoryleak
memoryleak / build-php5.5.sh
Last active March 4, 2016 14:23
Build PHP on Mac
#!/bin/bash
#
# Successfully build php-5.5.24 on Yosemite 10.10.3 (14D131) with following libraries / application installed via brew:
# autoconf
# automake
# fontconfig
# freetype
# gd
# icu4c
# imagemagick
#!/bin/bash
export PS1="[\[$(tput setaf 1)\]\u\[$(tput setaf 0)\]@\[$(tput setaf 4)\]$(hostname -s) \[$(tput setaf 0)\]\W]\\$: \[$(tput sgr0)\]"
@memoryleak
memoryleak / rebuildkext.sh
Created July 10, 2015 22:13
rebuild kext cache
#!/bin/bash
sudo kextcache -prelinked-kernel /System/Library/Kernels -K /System/Library/Caches/com.apple.kext.caches/Startup /System/Library/Extensions/
@memoryleak
memoryleak / mogrify.sh
Created July 20, 2015 10:49
Mogrify images with ImageMagick
mogrify -path OUTPUT_PATH \
-filter Triangle \
-define filter:support=2 \
-thumbnail OUTPUT_WIDTH \
-unsharp 0.25x0.25+8+0.065 \
-dither None \
-posterize 136 \
-quality 82 \
-define jpeg:fancy-upsampling=off \
-define png:compression-filter=5 \