Skip to content

Instantly share code, notes, and snippets.

function gzip-test()
{
curl -I -s -H 'Accept-Encoding: gzip,deflate' $1 | grep Content-Encoding: || echo "No compression enabled"
}
function gzip-test-x()
{
curl -I -s -H 'Accept-Encoding: gzip,deflate' $1 | grep Content-Encoding: || print -P -- "$FX[bold]$FG[001][ERROR]%f GZip Not Enabled$FX[reset]"; return
NOGZIP=`curl -so /dev/null $1 -w '%{size_download}'`
@Hamcha
Hamcha / main.coffee
Created October 7, 2012 14:32
HTML5 Slideshow in Coffeescript / JS
############################
### Global Variables ###
############################
slides = []
curSlideIndex = 0
window.blockedIO = false
############################
@Hamcha
Hamcha / Benchmark Results (on my PC)
Created October 19, 2012 15:11
Benchmark.sh Results
__ JAVASCRIPT V8 (v8) __
real 0m0.658s
user 0m0.654s
sys 0m0.008s
__ NODE.JS (node) __
real 0m0.734s
user 0m0.721s
@Hamcha
Hamcha / visualizer.glsl
Created November 24, 2012 13:24
Simple music visualizer for Live-Coder
uniform vec2 resolution;
uniform float lowFreq, midFreq, highFreq;
uniform float time;
vec3 circle(vec2 root, vec2 position, float radius, vec3 color)
{
if (distance(position, root) < radius) return color;
return vec3(0);
}
@Hamcha
Hamcha / pinkb.glsl
Created November 24, 2012 16:08
Pink thing
uniform vec2 resolution;
uniform float lowFreq, midFreq, highFreq;
uniform float time;
uniform vec2 mouse;
void rX(inout vec3 p, float a) { float c,s;vec3 q=p; c = cos(a); s = sin(a); p.y = c * q.y - s * q.z; p.z = s * q.y + c * q.z; }
void rY(inout vec3 p, float a) { float c,s;vec3 q=p; c = cos(a); s = sin(a); p.x = c * q.x + s * q.z; p.z = -s * q.x + c * q.z;}
void rZ(inout vec3 p, float a) { float c,s;vec3 q=p; c = cos(a); s = sin(a); p.x = c * q.x - s * q.y; p.y = s * q.x + c * q.y; }
uniform vec2 resolution;
uniform float lowFreq, midFreq, highFreq;
uniform float time;
uniform vec2 mouse;
void rX(inout vec3 p, float a) { float c,s;vec3 q=p; c = cos(a); s = sin(a); p.y = c * q.y - s * q.z; p.z = s * q.y + c * q.z; }
void rY(inout vec3 p, float a) { float c,s;vec3 q=p; c = cos(a); s = sin(a); p.x = c * q.x + s * q.z; p.z = -s * q.x + c * q.z;}
float star(vec3 p, float s) { return length(p)-s; }
float starfield(vec3 p, float s, vec3 c) { vec3 q = mod(p,c)-.5*c; return star(q,s); }
@Hamcha
Hamcha / log.go
Last active January 1, 2016 01:09
Logsrv ported from Coffeescript (Node.JS) to Go trying to reduce Memory usage - Node.js version: 26.5MiB - Go version: 3.7MiB
package main
import (
"io/ioutil"
"net/http"
"html/template"
)
type ChatLog struct {
Content string
@Hamcha
Hamcha / fdoc.md
Last active January 2, 2016 11:19
Speedcoding library

Speedcoding library

Functions

init()

Initializes the canvas element and fires up the render loop.

Default canvas size is 600x600, you can override it by calling init(true) to make it fill the screen or init(w,h) for a custom width (w) and height (h).

clear() , clearp(a)

@Hamcha
Hamcha / speed.js
Last active January 25, 2016 15:25
Speedcoding lib v2.1
// Speedcoding library by @hamcha
// ver. 2.1
// Oval function by Deven Kalra
w=h=600;_w=window;_d=document;_fs=!w;
for(i in mf=Object.getOwnPropertyNames(Math))_w[mf[i]]=Math[mf[i]];
function clear(){$.ce(0,0,w,h)}
function clearp(a){$.fillStyle="rgba(255,255,255,"+a+")";$.fc(0,0,w,h);$.fillStyle="#000"}
function f(){$.fl()}
function s(){$.sr()}
@Hamcha
Hamcha / folders.gs
Last active August 16, 2016 21:15 — forked from anonymous/folders.gs
var folders = DriveApp.getFoldersByName("Università");
var subfolder = null;
if (folders.hasNext()) {
var folder = folders.next();
var subfolders = folder.getFoldersByName("Sbobine");
if (subfolders.hasNext()) {
var folder = subfolders.next();
var subsubfolders = folder.getFoldersByName("5o Anno");
if (subsubfolders.hasNext()) {
var folder = subsubfolders.next();