Skip to content

Instantly share code, notes, and snippets.

View kgabis's full-sized avatar

Krzysztof Gabis kgabis

View GitHub Profile
@kgabis
kgabis / cshuffle.c
Created September 22, 2011 11:22
stdin shuffle
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define START_SIZE 64
char * shuffle(char * array, int seed, int index, int len);
char * unshuffle(char * array, int seed, int index, int len);
void swap(char * a, char * b);
@kgabis
kgabis / hack.sh
Created April 11, 2012 15:58 — 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/2108403/hack.sh | sh
#
@kgabis
kgabis / nonograms.py
Created August 8, 2012 22:23
Nonogram solver for nonograms.net
#!/usr/bin/python
# This script solves encoded nonograms from site nonograms.net.
# When you create a nonogram and click encode, you are given an url
# with encoded nonogram (for instance http://nonograms.net?CxOuiPURF7Ii1ERa7u4AACuyNVVFqsi9VRa6uwAA).
# To solve it, you must pass a string after ? as an argument (CxOuiPURF7Ii1ERa7u4AACuyNVVFqsi9VRa6uwAA).
import base64
import sys
@kgabis
kgabis / markov_strings.c
Created October 18, 2012 21:37
Markov string generator
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define to_index(a) (a - 97)
#define to_char(a) (a + 97)
int main(int argc, const char *argv[]) {
char letters[26][2048];
int point2d_nquad_of_rectangled_old(Point2D point, RectangleD rect) {
int i;
for (i = 0; i < 4; i++) {
if (point2d_is_in_rectangled(point, rectangled_nquad(rect, i))) {
return i;
}
}
return -1;
}
@kgabis
kgabis / .emacs
Last active December 15, 2015 14:09
My emacs config
;; Save temp files in one place
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
CC = gcc
CFLAGS = -O3 -Wall -std=gnu99
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
CFLAGS += -lm
endif
with_libpng:
@kgabis
kgabis / Low Key.tmTheme
Last active January 18, 2017 12:48
Copy of xcode's "Low Key" theme for Sublime Text 2.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>xcode</string>
<key>name</key>
<string>Low Key</string>
<key>settings</key>
<array>
@kgabis
kgabis / Preferences.sublime-settings
Created April 14, 2013 12:22
My Sublime Text 2 config.
{
"color_scheme": "Packages/Color Scheme - Default/Low Key.tmTheme",
"font_face": "Menlo Regular",
"font_size": 11,
"detect_slow_plugins": false,
"ignored_packages":
[
"Vintage",
"Emmet"
],
@kgabis
kgabis / list.lotos
Created June 13, 2013 11:32
List in lotos
specification LIST : noexit
library NATURAL endlib
library BOOLEAN endlib
type LIST is NATURAL
sorts
LIST (*! implementedby LIST
comparedby CMP_LIST
iteratedby ENUM_FIRST_LIST and ENUM_NEXT_LIST