Skip to content

Instantly share code, notes, and snippets.

View svagionitis's full-sized avatar

stavros vagionitis svagionitis

View GitHub Profile
The Challenge
-------------
Given the following riddle, write a regular expression describing all possible answers,
assuming you never make a move which simply undoes the last one you made.
The Riddle
----------
You are on your way somewhere, taking with you your cabbage, goat, and wolf, as always.
You come upon a river and are compelled to cross it, but you can only carry one of the
three companions at a time. None of them can swim because this isn't THAT kind of riddle.
@cjbarber
cjbarber / hn-who-wants-to-be-hired
Last active August 29, 2015 14:01
HN: Who wants to be hired? (Template)
[Location], [Remote | Relocation], [Full Time | Contract | Part Time]
Stack: [Comma delimited list of technologies]
Resume: [Link to resume]
GitHub: [link to github]
LinkedIn: [link to linkedin]
@vvv
vvv / noexit.sh
Last active August 29, 2015 14:27
Surprise of the day
$ cat noexit.sh
#!/bin/sh
seq 100 | while read; do exit; done # If `exit' terminated the script ..
echo 'Still alive!' # .. this message would not be printed.
$
$ sh noexit.sh
Still alive!
#ifndef ma_concurrent_queue_h
#define ma_concurrent_queue_h
// Based on code from http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html
// Original version by Anthony Williams
// Modifications by Michael Anderson
#include "boost/thread.hpp"
#include <deque>
@gschizas
gschizas / bot.py
Last active September 21, 2015 12:09
# coding: utf-8
import urllib.parse
import praw
import configparser
import datetime
import http.server
import webbrowser
from dateutil.parser import parse as dateparser
@jdan
jdan / wiki-scraper.rb
Created January 21, 2012 21:23
(Nokogiri) Tests the idea that the first link on each wikipedia article will eventually lead to philosophy
#!/usr/bin/env ruby
# wiki-scraper.rb by Jordan Scales
# http://jordanscales.com
# http://programthis.net
#
# Tests the idea that the first link on each wikipedia article
# will eventually lead to philosophy
#
# Usage:
@ehamberg
ehamberg / gist:1875967
Created February 21, 2012 11:23
C Pointer Declarations

C/C++ Pointer Declaration Syntax – It makes sense!

I never really liked the way pointers are declared in C/C++:

int *a, *b, *c; // a, b and c are pointers to int

The reason is that I am used to reading variable declarations as MyType myVar1, myVar2, myVar3; and I always read “int*” as the type “integer pointer”�. I therefore wanted the following

int* a, b, c; // a is a pointer to int, b and c are ints
@pachacamac
pachacamac / clusterize.rb
Created May 22, 2012 19:11
Cluster algorithm for n-dimensional data and a given number of clusters
# A
# B
#
# D
#
# C
# E
#
# F
#
@vedantk
vedantk / apply.c
Created June 30, 2012 01:23
apply() in C
/*
* apply.c
*
* A basic implementation of apply() for systems that use the
* System V AMD64 calling convention.
*/
#include <string.h>
#include <sys/mman.h>
@danpal
danpal / Installing authy-ssh
Created August 28, 2012 17:25
Installing authy-ssh
Installation.
$ curl 'https://raw.github.com/authy/authy-ssh/master/authy-ssh' -o authy-ssh
$ sudo bash authy-ssh install /usr/local/bin
$ sudo /usr/local/bin/authy-ssh enable `whoami` <your-email> <your-country-code> <your-cellphone>
$ authy-ssh test
$ sudo service ssh restart