Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@andres-erbsen
andres-erbsen / enchtml.py
Created October 23, 2011 18:24
Python to javascript encryption - HTML is encrypted using AES and put in a JS string, decrypted on page load after getting password from user
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from sys import stdin, stdout, stderr
from optparse import OptionParser
from os import urandom
from hashlib import sha256
from Crypto.Cipher import AES
from base64 import b64encode
@sontek
sontek / snowjob.sh
Last active August 9, 2024 13:14
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
@sanchitgangwar
sanchitgangwar / snake.py
Created March 22, 2012 12:38
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@otanistudio
otanistudio / license.txt
Created June 5, 2012 23:14
Hey ladies and dudes, here's a quick typing indicator thing. Depends on any $ lib.
MIT License
Copyright (c) 2012 @otanistudio
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O
@MrDys
MrDys / gist:3512455
Created August 29, 2012 13:26
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id:
<div class="modal" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
@zziuni
zziuni / stuns
Created September 18, 2012 08:05
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@vodik
vodik / SOS.md
Last active June 28, 2024 04:08
_Never_ -Sy when installing!

Once upon a time there was a user that wanted to install firefox.

The user tried to do pacman -S firefox but it didn't work. The all mighty pacman reported that firefox-3.2.4-1.i686.pkg.tar.gz could not be found on his mirror. So the user tried pacman -Sy firefox. It worked and the user rejoiced since he could once again go and troll /h/.

But all was not good. The user had made a grave error!

See, when the user told the almighty pacman to -Sy firefox, pacman did

@zdk
zdk / git-merge-dry-run
Created July 9, 2013 03:19
When you need git merge --dry-run
git merge --no-commit --no-ff $BRANCH && git reset --hard HEAD
@FreeBirdLjj
FreeBirdLjj / switch.lua
Last active November 2, 2024 22:29
A way to write switch-case statements in lua.
print "Hello, switch"
-- If the default case does not have to be handled, we can use the following auxiliary function:
local function switch(value)
-- Handing `cases` to the returned function allows the `switch()` function to be used with a syntax closer to c code (see the example below).
-- This is because lua allows the parentheses around a table type argument to be omitted if it is the only argument.
return function(cases)
-- The default case is achieved through the metatable mechanism of lua tables (the `__index` operation).
setmetatable(cases, cases)