Skip to content

Instantly share code, notes, and snippets.

@saik0
saik0 / gol.rs
Last active January 25, 2017 22:39
fn on_render(&mut self, window: &mut PistonWindow, ren: RenderArgs, e: Event) {
let fps = self.fps_counter.tick();
let ref front = self.front;
window.draw_2d(&e, |c, g| {
let rect = Rectangle::new(color::BLACK);
clear(color::WHITE, g);
let mut i = 0;
let mut bounds = [0.0, 0.0, SIZE, SIZE];
@saik0
saik0 / keybase.md
Created July 24, 2015 02:34
Keybase Proof

Keybase proof

I hereby claim:

  • I am saik0 on github.
  • I am joelpedraza (https://keybase.io/joelpedraza) on keybase.
  • I have a public key whose fingerprint is 46E4 E501 0F1A 56F4 8235 9512 A092 F38E A440 C589

To claim this, I am signing this object:

@saik0
saik0 / cmap.clj
Last active August 29, 2015 14:19
Cumulative map
(defn cmap
"lazy cumulative map"
([f coll] (cmap f (f) coll))
([f val coll]
(cons val
(if (empty? coll)
nil
(lazy-seq (cmap f
(f val (first coll))
(rest coll))))))
(ns sieve.core
(:use clojure.data.priority-map)
(:gen-class))
(defn doto-last [coll f & args]
(let [idx (dec (count coll))
args (conj args (coll idx))]
(assoc coll idx (apply f args))))
(defn prime-gaps [gk-1]
@saik0
saik0 / PKGBUILD
Last active August 29, 2015 14:04
android-platform-20
_rev=r03
_sdkver=L
_sdkint=20
pkgname=android-platform-${_sdkint}
pkgver=${_sdkver}_${_rev}
pkgrel=2
pkgdesc="Android SDK Platform, API-${_sdkint}"
arch=('any')
url="http://developer.android.com/sdk/index.html"
license=('custom')
@saik0
saik0 / 90-uinput.rules
Last active April 8, 2016 23:00
xboxdrv: Xbox 360 Wireless Receiver with up to four gamepads
# Set the ownership and permissions for the uinput device
KERNEL=="uinput", OWNER="root", GROUP="uinput", MODE="0660"
if (get_application_name()=="Starbound - Beta") then
set_window_position2(0,0);
maximize();
undecorate_window();
end
@saik0
saik0 / PKGBUILD
Created September 19, 2013 14:22
Boson X PKGBUILD
# Maintainer: Ben R <thebenj88 *AT* gmail *DOT* com>
pkgname=boson-x
pkgver=1.0.1
_pkgver=${pkgver//\./_} # replace all '.' with '_'
pkgrel=3
pkgdesc="DRM-free rotational running game"
arch=('x86_64')
url="http://www.boson-x.com/"
license=('Custom')
source=("http://downloads.muandheyo.com/BosonX_v${_pkgver}_Linux.zip"
@saik0
saik0 / index.html
Created April 3, 2013 02:47
leaflet test
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" />
<![endif]-->
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>
<script type="text/javascript" src="leafletembed.js"></script>
</head>
<body onload="initmap();">
@saik0
saik0 / MyContentProvider.java
Created November 15, 2012 15:14
Sample ContentProvider that performs all operations transactionally and notifies once in batch operations.
public class MyContentProvider extends ContentProvider {
private final ThreadLocal<Boolean> mApplyingBatch;
private final ThreadLocal<Set<Uri>> mChangedUris;
private boolean applyingBatch() {
return mApplyingBatch.get() != null && mApplyingBatch.get();
}
private Uri insert(final Uri uri, final ContentValues values, final SQLiteDatabase db) {
// do the uri matching and insert