Skip to content

Instantly share code, notes, and snippets.

@BlockoS
BlockoS / openDisplay.c
Created December 9, 2009 20:57
Smallest possible raw X11 init
//// TODO :: 3. Clean up
//// 4. Events
//// 5. Create a colormap
//// 6. glx ?
#ifdef DEBUG
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/un.h>
#include <sys/select.h>
@malkia
malkia / fileinfo.c
Created December 16, 2011 18:54
Win32: Reading directory in one kernel call
// Not sure whether it's faster than FindFirstFile, etc. - but it does it in one kernel call
#include <windows.h>
#include <stdio.h>
// to compile:
// cl fileinfo.c setargv.obj
void fileinfo(const char*name);
int main( int argc, const char* argv[] )
@rygorous
rygorous / gist:2203834
Created March 26, 2012 08:03
float->sRGB8 using SSE2 (and a table)
// float->sRGB8 conversions - two variants.
// by Fabian "ryg" Giesen
//
// I hereby place this code in the public domain.
//
// Both variants come with absolute error bounds and a reversibility and monotonicity
// guarantee (see test driver code below). They should pass D3D10 conformance testing
// (not that you can verify this, but still). They are verified against a clean reference
// implementation provided below, and the test driver checks all floats exhaustively.
//
@uson1x
uson1x / hack.sh
Last active February 28, 2024 04:27 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2275613/hack.sh | sh
#
@aruld
aruld / YFact.java
Created October 27, 2012 20:12 — forked from jonbodner/YFact.java
Generic Y Combinator in Java 8 using lambdas
//based on code from http://www.arcfn.com/2009/03/y-combinator-in-arc-and-java.html and the generic version https://gist.github.com/2571928
class YFact {
// T function returning a T
// T -> T
public static interface Func<T> {
T apply(T n);
}
// Higher-order function returning a T function
@browny
browny / simple_socket_example.c
Last active March 29, 2024 20:30
simple socket example in C
/* --- Usage --- */
g++ server.c -o server
g++ client.c -o client
./server
./client 127.0.0.1
/* --- server.c --- */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
use warnings;
use Getopt::Std;
getopt('xytGgwsf',\%opts);
# pcm file = $opts{f}
# samples per pixel x
$xscale = $opts{x} // 1200;
@nico
nico / gist:5398098
Created April 16, 2013 18:02
ninja perf data for empty chromium builds over time.
Data was collected with:
time caffeinate ./runall.sh 4d9bf949e0fd6976725dea12bcc254fd39da6490 master ./gettime.sh | tee time.csv
$ cat runall.sh
#!/bin/bash
#
# This script runs a given command over a range of Git revisions. Note that it
# will check past revisions out! Exercise caution if there are important
@endolith
endolith / LICENSE.txt
Last active November 19, 2023 08:53
Python implementation of "Cookbook formulae for audio EQ biquad filter coefficients"
MIT License
Copyright (c) 2019 endolith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Rud5G
Rud5G / gist:5604323
Created May 18, 2013 12:57
Gerrit Code Review - Mass Abandon or Mass Approve
# create alias for cli gerrit requests
alias gerrit='ssh -p 29418 gerrit.yourdomain.com gerrit'
# get tempfile for the ids
tmpfileids=$(tempfile -d /tmp)
# get all commit number ids for the project YOUR_PROJECT_NAME
gerrit query 'status:open project:YOUR_PROJECT_NAME' | egrep '^\ +number' | cut -d' ' -f4- > $tmpfileids
# do mass abandon