Skip to content

Instantly share code, notes, and snippets.

View lukasklein's full-sized avatar
👀
Facebook is it you?

Lukas Klein lukasklein

👀
Facebook is it you?
View GitHub Profile
from datetime import datetime
LINES = [
'ITLISBFAMPM',
'ACQUARTERDC',
'TWENTYFIVE<X',
'HALFBTEN<FTO',
'PASTERUNINE',
'ONESIXTHREE',
'FOURFIVE>TWO',
{
"page": 1,
"limit": 50,
"explicit": false,
"total": 16,
"has_more": false,
"list": [{
"id": "music",
"name": "Music",
"description": "Watch music videos, concerts, and interviews from artists in every genre, from hip-hop and rock to indie and electro. Live performances, news and exclusives."
@lukasklein
lukasklein / output
Created April 23, 2015 16:53
PHP can't handle Moscow Time
+02:00 # Correct
+04:00 # Wrong, it has been set to UTC+3 permanently on 26 October 2014: http://sputniknews.com/russia/20141026/194606015.html
#!/usr/bin/env python
"""
Facebook-Event-Stalking-Tool
"""
import urllib2, json, re
from types import NoneType
access_token = "your facebook access token"
//
// CameraAvailable.h
//
//
// Created by Lukas Klein on 08-19-11.
// MIT Licensed
// Copyright (c) Lukas Klein
#import <foundation foundation.h="">
#ifdef PHONEGAP_FRAMEWORK
import random, os, urllib, urllib2, time, getpass
from urlparse import urlparse
rootpass = getpass.getpass()
interface = "en0"
testurl = "http://www.google.com/robots.txt"
stringtotest = "User-agent: *"
def randomMAC():
mac = [ 0x00, 0x16, 0x3e,
from django.conf import settings
def get_client_ip(request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
else:
ip = request.META.get('REMOTE_ADDR')
return ip
docker:
image: jpetazzo/dind
privileged: true
environment:
- PORT=4444
transcoder:
build: transcoder
restart: always
command: /usr/local/bin/gunicorn -w 2 -b :8000 app:app
links:
@lukasklein
lukasklein / analyze.py
Created October 12, 2012 18:52
Subsitution cipher helper
import json
english_json = open('english.json', 'r').read()
frequencies_english = json.loads(english_json)
frequencies_english_sorted = []
for char in sorted(frequencies_english, key=frequencies_english.get, reverse=True):
frequencies_english_sorted.append({'char': char, 'frq': frequencies_english[char]})
def generate(code):
code_obj = compile(code, '<string>', 'exec')
code_ = code_obj.co_code
code = ''
for char in code_:
code += 'chr(' + str(hex(ord(char))) + ')+'
code = code[:-1]
return "type(make_secure)(code=type(make_secure.__code__)(%d,%d,%d,%d,%s,%s,%s,%s,'%s','%s',%d,'%s'),globals={})()" % (code_obj.co_argcount, code_obj.co_nlocals, code_obj.co_stacksize, code_obj.co_flags, code, str(code_obj.co_consts).replace(' ', ''), str(code_obj.co_names).replace(' ', ''), str(code_obj.co_varnames).replace(' ', ''), code_obj.co_filename, code_obj.co_name, code_obj.co_firstlineno, str(code_obj.co_lnotab))
if __name__ == "__main__":