Skip to content

Instantly share code, notes, and snippets.

View kgabis's full-sized avatar

Krzysztof Gabis kgabis

View GitHub Profile
@kgabis
kgabis / leftright.c
Last active December 25, 2015 23:49
Algorithms 01
#include <stdio.h>
typedef struct {
float x, y;
} vec2;
float vec2_cross(vec2 a, vec2 b) {
return a.x * b.y - a.y * b.x;
}
@kgabis
kgabis / remrawxmp.cs
Created August 6, 2013 13:58
Removes raws without matching xmp file.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace remrawxmp
{
class Program
@kgabis
kgabis / remraws.sh
Created July 14, 2013 17:30
Removing orphaned raws (without matching JPG file higher in hierarchy).
#!/bin/bash
RAWS=raws/*.NEF
for raw in $RAWS
do
echo -n "Checking $raw - "
rawb=$(basename $raw)
jpg="${rawb%%.*}.JPG"
if [ ! -f $jpg ];
then
@kgabis
kgabis / dining.lotos
Created June 19, 2013 14:41
Dining philosophers in lotos.
specification PHILOSOPHERS [think, eat, req, rel] : noexit
library BOOLEAN endlib
library NATURAL endlib
behaviour
(
Philosopher[think, eat, req, rel](1)
|||
Philosopher[think, eat, req, rel](2)
@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
@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 / 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>
CC = gcc
CFLAGS = -O3 -Wall -std=gnu99
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
CFLAGS += -lm
endif
with_libpng:
@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
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;
}