Skip to content

Instantly share code, notes, and snippets.

View markuman's full-sized avatar
🐧
Linux Only - fail fast, move on

Markus Bergholz markuman

🐧
Linux Only - fail fast, move on
  • Lekker Energie GmbH
  • Berlin
View GitHub Profile
@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@hikoz
hikoz / dd.py
Created December 15, 2010 04:45
dd with progress in python
#!/usr/bin/env python
import sys
import time
import signal
from subprocess import Popen, PIPE
dd = Popen(['dd'] + sys.argv[1:], stderr=PIPE)
while dd.poll() is None:
time.sleep(.3)
dd.send_signal(signal.SIGUSR1)
@pklaus
pklaus / ping.py
Created March 5, 2011 09:50
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@diogok
diogok / proxy.lua
Created April 15, 2011 17:09
Simple HTTP reverse proxy in Lua
#!/usr/bin/env lua
require 'socket'
require 'copas'
assert(arg[1],"Must pass host and port to listen")
assert(arg[2],"Must pass host and port to proxy")
local config = {
newhost=string.gsub(arg[1],"([^:]+):(%d+)","%1"),
newport=string.gsub(arg[1],"([^:]+):(%d+)","%2"),
@mkottman
mkottman / id3.lua
Created August 22, 2011 12:13
An ID3 tag reader implemented in pure Lua. Supports ID3v1 tags and a subset of ID3v2 tags.
--- A simple module to read ID3 tags from MP3 files.
-- Supports ID3v1 tags and a (meaningful) subset of ID3v2 tags.
-- @class module
-- @name id3
-- @author Michal Kottman
-- @copyright 2011, released under MIT license
local id3 = {}
local function textFrame(name)
require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
@battlehorse
battlehorse / multi_dashboard.html
Created September 26, 2011 14:28
A Google Charts dashboard setup where multiple datatables are used to power a single 'logical' dashboard.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});
@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@Deco
Deco / coroutine_scheduler.lua
Created February 13, 2012 16:38
Lua Coroutine Scheduler
pcall(require,"socket")
local coroutine_scheduler = {
_NAME = "coroutine_scheduler.lua"
_VERSION = "1.0.0",
}
local Scheduler
do Scheduler = setmetatable({}, {
__call = function(class)
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})