Skip to content

Instantly share code, notes, and snippets.

View fizerkhan's full-sized avatar

Fizer Khan (பைசர் கான்) fizerkhan

View GitHub Profile
@maccman
maccman / jquery.onclose.coffee
Last active July 3, 2022 08:17
jQuery plugin to notify users if they close the page, and there are still some Ajax requests pending.
$ = jQuery
TRANSFORM_TYPES = ['PUT', 'POST', 'DELETE']
$.activeTransforms = 0
$(document).ajaxSend (e, xhr, settings) ->
return unless settings.type in TRANSFORM_TYPES
$.activeTransforms += 1
@hzbd
hzbd / haproxy.config
Created May 4, 2013 17:34
Sample HAProxy config with logging.
global
pidfile /var/run/haproxy.pid
log 127.0.0.1 local0 info
ulimit-n 65536
defaults
mode http
clitimeout 600000 # maximum inactivity time on the client side
srvtimeout 600000 # maximum inactivity time on the server side
@Bren2010
Bren2010 / HearSay.md
Last active October 7, 2023 03:42
The HearSay P2P File Sharer

HearSay

The HearSay P2P File Sharer; a response to The Copyright Alert System, as well as several other internet regulation attempts. The goal of this project is to prove the viability of semi-anonymous and confidential file sharing. Consists of several proofs of concepts such as the formation of ad-hoc mix networks and routing throughout them while maintaining anonymity and semantic security.

However, lets be honest with ourselves for a second. Don't use this to fight an oppressive regime. I can not (and will not try) to 'prove' its security, and I

@machadogj
machadogj / MyClass.js
Created April 5, 2013 20:59
Sample code for understanding error handling in node.js.
var util = require('util'),
EventEmitter = require('events').EventEmitter;
var MyClass = function () {
if (!(this instanceof MyClass)) return new MyClass();
EventEmitter.call(this);
};
@mkuklis
mkuklis / gist:5294248
Last active September 7, 2021 21:39
auto curry in JavaScript
function toArray(args) {
return [].slice.call(args);
}
function autocurry(fn) {
var len = fn.length;
var args = [];
return function next() {
args = args.concat(toArray(arguments));
return (args.length >= len) ?
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@lazarofl
lazarofl / a_mongodb_to_s3_backup.sh
Last active April 19, 2022 05:06
MongoDB Automatic Backup to Amazon S3 with Crontab and s3cmd. Red Hat Linux on Amazon EC2
#!/bin/bash
#Force file syncronization and lock writes
mongo admin --eval "printjson(db.fsyncLock())"
MONGODUMP_PATH="/usr/bin/mongodump"
MONGO_HOST="prod.example.com"
MONGO_PORT="27017"
MONGO_DATABASE="dbname"
@dirkk0
dirkk0 / gist:4530915
Last active December 11, 2015 02:29
Installing Telescope ( https://github.com/SachaG/Telescope)
# https://github.com/SachaG/Telescope
########################
# it should be
sudo apt-get install git npm
curl https://install.meteor.com | /bin/sh
sudo npm install -g meteorite
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@sindresorhus
sindresorhus / codestyle.md
Last active September 26, 2023 07:45
My preferred code style.

Code Style

  • Tab indentation
  • Single-quotes
  • Semicolon
  • Strict mode
  • No trailing whitespace
  • Multiple variable statements
  • Space after keywords and between arguments and operators
  • Return early