Skip to content

Instantly share code, notes, and snippets.

View skorokithakis's full-sized avatar
💭
Better thus than not at all.

Stavros Korokithakis skorokithakis

💭
Better thus than not at all.
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1F9nnKh3GncLxANsF245mtcnp8UiQK8Ddr https://explorer.blockstack.org/address/1F9nnKh3GncLxANsF245mtcnp8UiQK8Ddr

Keybase proof

I hereby claim:

  • I am skorokithakis on github.
  • I am stavros (https://keybase.io/stavros) on keybase.
  • I have a public key ASD0HG50JQNyi4_Zzw5LEmEonXKKea0tf3oMA9CCEM3TlQo

To claim this, I am signing this object:

@skorokithakis
skorokithakis / string_to_int.py
Created August 17, 2015 14:40
String to int and back.
import math
def string_to_int(string):
"""Convert a string to the equivalent integer."""
# For each character, convert to an integer, convert that to hex,
# remove the first two chars ("0x") and left-pad with a zero.
hexchars = [hex(ord(x))[2:].rjust(2, "0") for x in string]
return int("".join(hexchars), 16)
@skorokithakis
skorokithakis / meetuphtml.js
Created May 6, 2015 18:32
meetup.com editor HTML
r = $("#_description").data("redactor");r.$toolbar.prepend($('<li>').append(r.buildButton("html", r.opts.toolbar["html"])));
@skorokithakis
skorokithakis / fish_prompt.fish
Created January 27, 2015 00:02
Fish git prompt
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
### Keybase proof
I hereby claim:
* I am skorokithakis on github.
* I am stavros (https://keybase.io/stavros) on keybase.
* I have a public key whose fingerprint is F877 F376 9A96 3217 FBD6 D1CD 91DD F089 422C EFA2
To claim this, I am signing this object:
@skorokithakis
skorokithakis / decompress.py
Created February 8, 2012 19:36
Flash decompression
import zlib
infile = open("test.swf", "rb")
infile.seek(0, 0)
if infile.read(3) == "CWS":
data = "FWS" + infile.read(5) + zlib.decompress(infile.read())
open("decompressed.swf", "wb").write(data)
@skorokithakis
skorokithakis / __init__.py
Created February 5, 2012 02:32
Badginator Python API
import hashlib
import urllib, urllib2
class Badginator(object):
def __init__(self, game_key):
self.game_key = game_key
def _sign(self, user_key, achievement_id):
return hashlib.sha1(self.game_key + user_key + achievement_id).hexdigest()
@skorokithakis
skorokithakis / zipimport.py
Created January 9, 2011 18:46
Import zips and eggs for AppEngine.
import sys, os
package_dir = "packages"
sys.path.insert(0, package_dir)
for filename in os.listdir(package_dir):
if filename.endswith((".zip", ".egg")):
sys.path.insert(0, "%s/%s" % (package_dir, filename))