This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fermat(n): | |
if n == 2: | |
return True | |
if not n & 1: | |
return False | |
return pow(2, n-1, n) == 1 | |
# benchmark of 10000 iterations of fermat(100**10-1); Which is not prime. | |
# 10000 calls, 21141 per second. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically adds the JIRA ticket number to the end of every commit message. | |
# This will work provided your branch is named in the form [a-zA-Z]{3}-[0-9]{3,} | |
# Place this file in PROJECT/.git/hooks and make it executable chmod +x path/to/file | |
# Example: | |
# [BND-1234] <--- This is a branch name | |
# $ git commit -am "This is my message" | |
# [BND-1234 1edab53] This is my message [BND-1234] | |
# | |
# [BND-1234-This-Branch-Has-A-Description] <--- This is a branch name | |
# $ git commit -am "This is my message" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Welcome | |
Welcome to Stackoverlfow! You will greatly increase your chances of getting an answer for your question if you include your input, what you have tried, your expected output vs. your actual output and the full stack trace of any errors you receive. You can also read [this guide](http://stackoverflow.com/help/mcve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = ['a','b', 'c'] | |
for index, value in enumerate(l): | |
print("The value at index {} is {}".format(index, value) | |
# Output | |
# The value at index 0 is a | |
# The value at index 1 is b | |
# The value at index 2 is c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cover { coverage run --source='.' --omit='*.pyc. *.html' ./manage.py test $1;coverage html; } | |
export cover | |
alias coverall="coverage run --source='.' --omit='*.pyc. *.html' ./manage.py test account api group item;coverage html" | |
alias testall="./manage.py test account api channel group item moderation notifications payments" | |
# Git completion/colorful prompt | |
source ~/.git-completion.bash | |
source ~/.git-prompt.sh | |
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' | |
GIT_PS1_SHOWDIRTYSTATE=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"setting":{"duration":{"color":{"a":255,"r":255,"g":255,"b":255}},"border":{"color":{"a":255,"r":255,"g":255,"b":255}},"auras":[{"overlay":{"source":"1"},"dynamic":{"source":"1"},"behavior":"All","duration":{"source":"1"},"border":{"enable":true,"sprite":"sprAS_Chnl_Flash"},"stacks":{"source":"1"},"name":"Spell Surge","bar":{"source":"1"},"icon":{"sprite":"Icon_SkillMisc_UI_m_slvo","source":"1","posY":-227,"posX":-205},"triggers":[{"triggerType":"Buff","border":{"color":{"a":255,"r":255,"g":255,"b":255}},"spellName":"Spell Surge","unit":"Player","name":"Buff"}]},{"overlay":{"source":"1"},"charges":{"source":"1"},"dynamic":{"source":"1"},"behavior":"All","duration":{"source":"1"},"bar":{"source":"1"},"visibility":{"combat":false},"name":"Charged Shot","text":{"source":"1"},"icon":{"sprite":"Icon_SkillSpellslinger_charged_shot","source":"1","posX":-142,"height":45,"posY":-73,"width":45},"triggers":[{"triggerType":"Ability","border":{"color":{"a":255,"r":255,"g":255,"b":255}},"spellName":"Charged Shot","name":" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org_name=$1 | |
curl -s https://api.github.com/orgs/$org_name/repos\?per_page\=100 | perl -ne 'print "$1\n" if (/"ssh_url": "([^"]+)/)' | xargs -n 1 git clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
You'll need to isntall the C++ library libsnappy-dev and the Python bindings | |
for it to be able to use snappy compression | |
To install: | |
Linux: sudo apt-get install libsnappy-dev | |
OSX: brew isntall libsnappy-dev | |
Windows: You're boned |
OlderNewer