Skip to content

Instantly share code, notes, and snippets.

View codecakes's full-sized avatar
💭
I may be slow to respond.

codecakes codecakes

💭
I may be slow to respond.
View GitHub Profile
@codecakes
codecakes / thinksTwice.py
Created June 16, 2015 20:05
Cipher TranslationSimple Riddle
#!/usr/bin/env python
#URL: http://www.pythonchallenge.com/pc/def/map.html
from string import letters, maketrans
smallLetters = letters[:26]
shiftLetters = map(lambda let: smallLetters[(let+2)%26], xrange(len(smallLetters)))
@codecakes
codecakes / allowPortIP.sh
Created October 18, 2015 16:33
Open a Specific server port to a LAN ip
# allow a specific PORT to accept connection from an IP address
iptables -I INPUT -p tcp -s <IP> --dport <PORT> -j ACCEPT
git pull -r --tags -p <GIT REPO>
@codecakes
codecakes / pullRebase.sh
Created October 19, 2015 08:08
Pull changes without merging.
#Pull changes without merging
git pull -r --tags -p https://github.com/codecakes/etk.git
@codecakes
codecakes / ufwAllow.sh
Created October 21, 2015 03:57
Ufw Allow All Local LAN IPs
ufw allow from <ip>.0/24 to any port <PORT>
@codecakes
codecakes / fetchTrack.sh
Created October 21, 2015 04:11
fetch all git branches and track them
git fetch --all
for remote in `git branch -r`; do git branch --track $remote; done
@codecakes
codecakes / nvmLatest.sh
Created October 21, 2015 04:48
GEt latest Node version using nvm on Ubuntu
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
source ~/.bashrc
nvm install 0.12
@codecakes
codecakes / koDataBind.js
Created December 28, 2015 11:14
JsFiddle - KnockOut Data binding example
jsfiddle.net/zpvLv55h/
@codecakes
codecakes / seatReserve.js
Created December 28, 2015 14:40
Seat Reservation using knockout
https://jsfiddle.net/jnLnb1wq/
@codecakes
codecakes / randGen.py
Created January 14, 2016 15:32
How To Really Effectively Generate random numbers/strings
'''
Any Generator outputs an element x of type (Rational, Integer, Real, Complex, Character Set(s), any other type) from its Set X
s.t. x \subset X from a Given Set X or more.
So a pool of elements already given, from an academic point of view how is the RANDOMNESS in a function achieved?
'''
import random
def swap(minIndex, j, arr):
'''Swap elements from two given positions'''