Skip to content

Instantly share code, notes, and snippets.

View jleclanche's full-sized avatar
⛸️

Jerome Leclanche jleclanche

⛸️
View GitHub Profile
{'Data/enUS/expansion2-locale-enUS.MPQ': {'flags': '0', 'path': 'locale_enUS', 'fileversion': '15050', 'name': 'Data/enUS/expansion2-locale-enUS.MPQ', 'size': '10830439'}, 'Data/zhCN/wow-update-zhCN-15595.MPQ': {'flags': '0', 'path': 'base', 'fileversion': '15595', 'name': 'Data/zhCN/wow-update-zhCN-15595.MPQ', 'size': '23800336'}, 'Data/koKR/Interface/Cinematics/DSI_Act4_1280.avi': {'flags': '0', 'path': 'locale_koKR', 'fileversion': '12911', 'name': 'Data/koKR/Interface/Cinematics/DSI_Act4_1280.avi', 'size': '32407566'}, 'Data/enTW/Interface/Cinematics/WOW_Wrathgate_1280.avi': {'flags': '0', 'path': 'locale_enTW', 'fileversion': '12911', 'name': 'Data/enTW/Interface/Cinematics/WOW_Wrathgate_1280.avi', 'size': '103524628'}, 'Data/zhCN/Interface/Cinematics/DSI_Act4_1280.avi': {'flags': '0', 'path': 'locale_zhCN', 'fileversion': '12911', 'name': 'Data/zhCN/Interface/Cinematics/DSI_Act4_1280.avi', 'size': '32407566'}, 'Data/ptBR/Interface/Cinematics/DSI_Act3_800.avi': {'flags': '0', 'path': 'locale_ptBR', 'file
@jleclanche
jleclanche / weather.py
Created May 13, 2012 19:05
Quick python weather script using Google's Weather API
#!/usr/bin/env python
# encoding: utf-8
import sys
from argparse import ArgumentParser
from xml.dom import minidom
try:
from urllib.request import urlopen
from urllib.parse import urlencode
except ImportError:
@jleclanche
jleclanche / api.py
Last active December 14, 2015 11:49
Tastypie 0.9.12 SameUserAuthorization
from django.contrib.auth.models import User
from tastypie.authorization import Authorization, Unauthorized
class SameUserAuthorization(Authorization):
"""
Authorizes user to create, read and modify resources if they match
a specific or a set of users.
By default, this checks the user against the "user" attribute of the object.
To modify that behaviour, pass a custom `user` argument to
@jleclanche
jleclanche / d3
Last active August 29, 2015 13:57
Style improvements etc
#!/usr/bin/env python
import json
import sys
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
input = raw_input
@jleclanche
jleclanche / gist:9533710
Created March 13, 2014 18:13
Get plaintext patchnotes from the command line
function patchnotes {
ua="Battle.net/1.0.8.4217"
_baseurl="https://us.battle.net/connect/en/app"
usage="usage: $0 <product> [live|ptr|beta]\nproduct is one of wow, s2, d3, wtcg"
hash lynx 2>/dev/null || {
echo "You need to install Lynx first."
return 1
}
@jleclanche
jleclanche / update-tags.sh
Created May 1, 2014 18:16
Update tags to match their commit time
#!/bin/zsh
for tag in $(git tag); do
export GIT_AUTHOR_DATE="$(git log -1 --pretty=%ct $tag)"
export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
git tag -fam "Release v$tag" $tag $tag
done
function twitch {
if [[ $1 == "--check" ]]; then
streams=("day9tv" "totalbiscuit" "trumpsc" "noxious_hs")
for s in $streams; do
offline=$(curl --silent "https://api.twitch.tv/kraken/streams/$s/" | grep '"stream":null')
if [[ $offline == "" ]]; then
echo "$s is online"
fi
done
return
#!/usr/bin/env python
import json
import logging
import os
import re
import string
import sys
import requests
from datetime import datetime

Keybase proof

I hereby claim:

  • I am jleclanche on github.
  • I am jleclanche (https://keybase.io/jleclanche) on keybase.
  • I have a public key whose fingerprint is 1697 04C6 FB49 0C68 92C7 F23C 37E0 AF1F DA48 F373

To claim this, I am signing this object:

@jleclanche
jleclanche / github.py
Created March 2, 2015 07:56
Github mirror handler for LXQt
import hmac
import hashlib
import json
import logging
import os
import subprocess
import sys
from http.server import BaseHTTPRequestHandler, HTTPServer
try: