Skip to content

Instantly share code, notes, and snippets.

View greister's full-sized avatar
🎯
Focusing

greister

🎯
Focusing
View GitHub Profile
rsa==3.1.1
requests==1.2.3
@greister
greister / rails-vagrant-provision.sh
Last active November 15, 2015 05:43 — forked from johanneswuerbach/rails-vagrant-provision.sh
Provision a vagrant box with ruby stable (using rvm), postgres, redis and node (using nvm)
#!/usr/bin/env bash
version=$1 || 2.2.3
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
sudo apt-get update
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
import Glibc
/*
Did a bunch of tweaks this morning:
removed == true (sorry Kametrixom!)
cleaned up both stringFromBytes and bytesFromString
changed fperror check to guard
replaced use of 1024 in several places with a single constant
*/
@greister
greister / stuff.md
Created December 29, 2015 22:32 — forked from erica/stuff.md

Creating a Package

You deal with three kinds of packages: wrapping headers and libraries, building custom libraries, and wrapping Swift. This is the first type.

  1. Create a new folder. Name it, e.g. BasePackage
  2. Add four text files: base.h, Makefile, module.modulemap, Package.swift

Building the Package.swift file

@greister
greister / String.swift
Created December 30, 2015 17:15 — forked from kharrison/String.swift
Swift String Playground Examples
// Swift Standard Librray - String
// Keith Harrison http://useyourloaf.com
// Import Foundation if you want to bridge to NSString
import Foundation
// ====
// Initializing a String
// ====
extension String {
/// Range of first match to string
func rangeOfString(searchString: String) -> Range<Index>? {
// If equality, return full range
if searchString == self {return startIndex..<endIndex}
// Basic sanity checks
let (count, stringCount) = (characters.count, searchString.characters.count)
@greister
greister / weechat
Created January 17, 2016 16:02 — forked from cirrusUK/weechat
my weechat configs
/server add Dalnet irc.dal.net/6697
/set irc.server.Dalnet.autoconnect on
/set irc.server.Dalnet.autojoin "#Scotland,#soccer,#cafechat,#ALLNITECAFE,#androidirc,#apple,#bsd,#linux"
/set irc.server.Dalnet.username "cirrus"
/server add geekshed irc.geekshed.net/6667
/server del freenode
/mouse enable|disable|toggle [<delay>]
@greister
greister / playground.rs
Created April 16, 2016 04:07 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::thread;
use std::sync::Arc;
use std::rc::Rc;
use std::fmt::Debug ;
pub fn get_insertion_index<K: Ord + Debug + Clone>(values: &[K], k: &K) -> usize {
let mut index = 0;
for v in values{
if *v >= *k { break;}
index += 1;
@greister
greister / playground.rs
Created April 16, 2016 04:08 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::hash::Hash;
use std::collections::{HashMap, HashSet};
pub type Value = u32;
// list of values, assumed to be small to large
pub const VALUES : [Value; 5] = [1, 2, 3, 4, 5];
pub trait Info<T> where T: Hash + Eq + Clone + Copy {
@greister
greister / playground.rs
Created April 16, 2016 04:09 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::hash::Hash;
use std::collections::{HashMap, HashSet};
use std::slice;
pub type Value = u32;
// list of values, assumed to be small to large
pub static VALUES: [Value; 5] = [1, 2, 3, 4, 5];