Skip to content

Instantly share code, notes, and snippets.

View dsamarin's full-sized avatar

Devin Samarin dsamarin

View GitHub Profile
@dsamarin
dsamarin / countries.dat
Created January 11, 2012 02:07
Country population data
1 | China | 1.35 billion people
2 | India | 1.21 billion people
3 | United States | 309 million people
4 | Indonesia | 233 million people
5 | Brazil | 195 million people
6 | Pakistan | 185 million people
7 | Bangladesh | 164 million people
8 | Nigeria | 158 million people
9 | Russia | 140 million people
10 | Japan | 127 million people
/msg ChanServ FLAGS #oftn sephr chair
/msg ChanServ FLAGS #oftn eboyjr vice-chair
/msg ChanServ FLAGS #oftn cloudhead board-member
/msg ChanServ FLAGS #oftn devyn board-member
/msg ChanServ FLAGS #oftn gkatsev board-member
/msg ChanServ FLAGS #oftn GothAlice board-member
/msg ChanServ FLAGS #oftn inimino board-member
/msg ChanServ FLAGS #oftn yrashk board-member
/msg ChanServ FLAGS #oftn *!*@freenode/staff/* freenode-staff
/msg ChanServ FLAGS #oftn oftn-bot bot
@dsamarin
dsamarin / bmp.c
Created March 20, 2012 02:50
BMP file dimensions
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
int main(int argc, char* argv[]) {
int width, height;
unsigned char data[8];
FILE *file;
@dsamarin
dsamarin / add.txt
Created July 17, 2012 08:22
Irssi Unicode Fetish
/completion -auto '-sun' ☀
/completion -auto '-cloud' ☁
/completion -auto '-umbrella' ☂
/completion -auto '-snowman' ☃
/completion -auto '-comet' ☄
/completion -auto '-star' ★
/completion -auto '-telephone' ☎
/completion -auto '-box' ☐
/completion -auto '-boxcheck' ☑
/completion -auto '-cup' ☕
@dsamarin
dsamarin / gist:3184701
Created July 26, 2012 21:35
Basic Regexp functionality in 30 lines of C
/* match: search for regexp anywhere in text */
int match(char *regexp, char *text)
{
if (regexp[0] == '^')
return matchhere(regexp+1, text);
do { /* must look even if string is empty */
if (matchhere(regexp, text))
return 1;
} while (*text++ != '\0');
return 0;
Which of the following are continuous functions? (Select all that apply.)
The temperature at a specific location as a function of time.
The temperature at a specific time as a function of the distance due west from New York City.
The altitude above sea level as a function of the distance due west from New York City.
The cost of a taxi ride as a function of the distance traveled.
The current in the circuit for the lights in a room as a function of time.
None of these.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
int main (int argc, char *argv[]) {
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
struct node;
struct edge;
struct node {
char *name;
struct edge *edges;
@dsamarin
dsamarin / pipes.sh
Last active December 12, 2015 05:49
#!/bin/bash
# The author of the original script is unknown to me. The first entry I can
# find was posted at 2010-03-21 09:50:09 on Arch Linux Forums (doesn't mean the
# poster is the author at all):
#
# https://bbs.archlinux.org/viewtopic.php?pid=728932#p728932
#
# I, Yu-Jie Lin, made a few changes and additions:
#
# -p, -R, and -C
@dsamarin
dsamarin / gist:5633174
Created May 23, 2013 06:53
Example xz.js API with navigator.cores
save_button.addEventListener("click", function() {
xz.compress(serializeDB(), function(compressed) {
saveAs(compressed, "db.xz");
});
});