Skip to content

Instantly share code, notes, and snippets.

View peters's full-sized avatar
😀
On

Peter Rekdal Khan-Sunde peters

😀
On
View GitHub Profile
@itszero
itszero / kb-ipad.html
Created May 14, 2011 11:44
CSS iPhone Keyboard Clone
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Keyboard</title>
<style type="text/css">
#keyboard {
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #9199A4), color-stop(50%, #7D8591), color-stop(100%, #535C69));
border-radius: 10px;
background-color: #9199A4;
@rstackhouse
rstackhouse / gist:1162357
Created August 22, 2011 13:22
Configure NLog Programmatically
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NLog.Common;
using NLog.Targets;
using NLog.Config;
namespace ConsoleApplication1
@utaal
utaal / Makefile
Created September 5, 2011 16:42
webserver using libuv
webserver: webserver.c libuv/uv.a http-parser/http_parser.o
gcc -I libuv/include \
-lrt -lm -lpthread -o \
webserver webserver.c \
libuv/uv.a http-parser/http_parser.o
libuv/uv.a:
$(MAKE) -C libuv
http-parser/http_parser.o:
@jawspeak
jawspeak / c10k-test-client.c
Created December 19, 2011 16:32 — forked from rsms/c10k-test-client.c
C binary to drive heavy load on a web server. 10K+ requests / second. Seems roughly equivalent to 'ab', and heaver load than httperf.
// HTTP client for testing high connection concurrency
// Authors: Richard Jones and Rasmus Andersson
// Released in the public domain. No restrictions, no support.
// SEE:
// http://rsms.me/2009/10/05/10k-comet-connections.html
#include <sys/types.h>
#include <sys/time.h>
#include <sys/queue.h>
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace TaskOverlapped
{
class Program
{
static void Main(string[] args)
{
@schappim
schappim / checkv4l.js
Created June 14, 2012 02:50
Node.js code to check for presence of video for linux device.
var Inotify = require('inotify-plusplus'), // should be 'inotify++', but npm has issues with the ++
inotify,
directive,
options;
inotify = Inotify.create(true); // stand-alone, persistent mode, runs until you hit ctrl+c
//inotify = Inotify.create(); // quits when event queue is empty
directive = (function() {
@martinsik
martinsik / libwebsockets-webserver.c
Created July 31, 2012 11:34
Simple webserver based on libwebsockets library. Read full description at http://martinsikora.com/libwebsockets-simple-http-server
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libwebsockets.h>
static int callback_http(struct libwebsocket_context *context,
struct libwebsocket *wsi,
enum libwebsocket_callback_reasons reason, void *user,
@abulte
abulte / bootstrap.sh
Created October 19, 2012 10:21
Build a custom RPI image
#!/bin/bash
# Based on work by Klaus M Pfeiffer at http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/
# you need to do: "sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools"
# run with "sudo bootstrap.sh /dev/sd[x]"
echo "Use like: sudo bootstrap.sh /dev/sd[x]"
#deb_mirror="http://ftp.debian.org/debian"
#deb_local_mirror="http://ftp.debian.org/debian"
@roxlu
roxlu / SSLBuffer.cpp
Created November 2, 2012 11:38
libuv + openssl + SSLBuffer
#include "SSLBuffer.h"
SSLBuffer::SSLBuffer()
:ssl(NULL)
,read_bio(NULL)
,write_bio(NULL)
,write_to_socket_callback(NULL)
,write_to_socket_callback_data(NULL)
,read_decrypted_callback(NULL)
,read_decrypted_callback_data(NULL)
@wholypantalones
wholypantalones / gist:4233688
Created December 7, 2012 14:44
Google Maps V3 API Draggable Rectangle
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(43, -85),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
var geocoder = new google.maps.Geocoder();
$("#search_address").focus().autocomplete({