Skip to content

Instantly share code, notes, and snippets.

// A solution for http://www.geeksforgeeks.org/archives/25739
//
// Given two numbers represented by two linked lists, write a function that
// returns sum list. The sum list is linked list representation of addition of
// two input numbers. It is not allowed to modify the lists. Also, not allowed
// to use explicit extra space (Hint: Use Recursion).
//
// Example:
//
// Input:
@detunized
detunized / suspend-on-power-button.sh
Created October 19, 2012 09:28
Make Gnome Shell suspend on hardware power button without asking questions
gsettings set org.gnome.settings-daemon.plugins.power button-power suspend
@detunized
detunized / main.m
Created October 15, 2012 08:42
Redirect stderr into a pipe, filter and then write to stdout (for NSLog filtering)
int main(int argc, char *argv[])
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) {
size_t const BUFFER_SIZE = 2048;
// Create a pipe
int pipe_in_out[2];
if (pipe(pipe_in_out) == -1)
return;
@detunized
detunized / output.txt
Created July 2, 2012 16:11
List all subsets of a given set
[[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3], [4], [1, 4], [2, 4], [1, 2, 4], [3, 4], [1, 3, 4], [2, 3, 4], [1, 2, 3, 4]]
@detunized
detunized / globals.rb
Created January 16, 2012 12:24
List global Ruby variables and their values
global_variables.sort.each do |name|
puts "#{name}: #{eval "#{name}.inspect"}"
end
@detunized
detunized / gist:1317940
Created October 26, 2011 21:29
Magnifying glass shader
// (c) 2011 detunized (http://detunized.net)
// Paste the shader below into http://www.iquilezles.org/apps/shadertoy/?p=deform
// Click and drag the mouse around
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 resolution;
uniform vec4 mouse;