Skip to content

Instantly share code, notes, and snippets.

@hfeeki
hfeeki / HexByteConversion.py
Created January 20, 2014 07:05
Hex Byte Conversion
"""
HexByteConversion
Convert a byte string to it's hex representation for output or visa versa.
ByteToHex converts byte string "\xFF\xFE\x00\x01" to the string "FF FE 00 01"
HexToByte converts string "FF FE 00 01" to the byte string "\xFF\xFE\x00\x01"
"""
#-------------------------------------------------------------------------------
@hfeeki
hfeeki / install_redis.sh
Last active January 3, 2016 20:19
Install new redis in ubuntu
wget http://download.redis.io/releases/redis-2.8.4.tar.gz
tar xzf redis-2.8.4.tar.gz
cd redis-2.8.4
make
sudo make install
cd utils
sudo ./install_server
@hfeeki
hfeeki / hosts
Created January 18, 2014 13:10
hosts for GFW
74.125.128.102 golang.org
54.234.135.251 get.docker.io
54.234.135.251 cdn-registry-1.docker.io
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
__func = None
def get_terminal_size():
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
package main
import (
eventsource "github.com/antage/eventsource/http"
redis "github.com/vmihailenco/redis"
"log"
"net/http"
)
func haltOnErr(err error){
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
/*
* Copyright (C) 2012, xp@renzhi.ca
* All rights reserved.
*
* Ported to rust 0.4 by kevin@sb.org
*/
extern mod std;
use task::*;
@hfeeki
hfeeki / install_go_pkg.sh
Created January 15, 2014 11:14
Some golang packages
go get github.com/codegangsta/martini
go get github.com/codegangsta/martini-contrib/...
@hfeeki
hfeeki / nodeloop.erl
Last active January 3, 2016 07:49
Process ring.
%% from https://erlangcentral.org/wiki/index.php/Process_Ring_Across_Nodes
%%
%% Written by Mazen Harake
%% GPLv3 License -> http://www.gnu.org/licenses/gpl-3.0.txt
-module(nodeloop).
-compile(export_all).
start(N) when N > 0 ->
erlang:register(head, proc_lib:spawn_link(?MODULE, head_proc, [nil, nil])),
create_links(N).