This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::path::Path; | |
static PATHS: [&'static str, .. 4] = ["/bin", "/sbin", "/usr/bin", "/usr/sbin"]; | |
// Tries to find an executable | |
// TODO: Look for the executable bit for the select user/group | |
fn look_path(program: ~str, root: ~Path) -> Option<Path> { | |
let cmd = Path::new(program.clone()); | |
if cmd.is_absolute() || program.contains("/") { // TODO: Use path::SEP | |
Some(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Proc | |
def with_args(*args, &block) | |
proc do |obj| | |
call(obj, *args, &block) | |
end | |
end | |
end | |
class Symbol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install benchmark-ips | |
require 'benchmark/ips' | |
class << Time | |
attr_accessor :current | |
end | |
Time.current = Time.now | |
Benchmark.ips do |x| | |
x.report("Time.now") do |n| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/socket.h> | |
#include <linux/netlink.h> | |
#include <linux/connector.h> | |
#define _LINUX_TIME_H | |
#include <linux/cn_proc.h> | |
#include <errno.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? (import <nixpkgs> {}) | |
, stdenv ? pkgs.stdenv | |
, go ? pkgs.go | |
, git ? pkgs.git | |
}: | |
let | |
gitref = { name, source }: | |
import ( | |
pkgs.runCommand "${name}-gitref" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? (import <nixpkgs> {}) | |
, stdenv ? pkgs.stdenv | |
, go ? pkgs.go | |
, git ? pkgs.git | |
}: | |
rec { | |
readChop = with builtins; path: | |
let | |
str = readFile path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Instead of having to set DOCKER_HOST or run `$(boot2docker shellinit)` just start this | |
# script in the background. | |
# | |
# Depends on `brew install boot2docker socat` | |
socket=`boot2docker socket 2>/dev/null | sed 's|tcp://||'` | |
exec sudo socat -d -d -ls UNIX-LISTEN:/var/run/docker.sock,fork,mode=0777 TCP4:$socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "formula" | |
class Rmlint < Formula | |
homepage "https://github.com/sahib/rmlint" | |
head "https://github.com/zimbatm/rmlint.git", branch: "master" | |
def install | |
system "make", "install", "PREFIX=#{prefix}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Encapsulate the configuration DSL pattern. | |
# | |
# Any `X=(value)` setter method on the given +obj+ is translated into `X(value)` method | |
# in the context of this object. | |
class ConfigDSL < BasicObject | |
def initialize(obj, &config) | |
@self = obj | |
call(&config) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Settings | |
"" Global | |
set nocompatible | |
set encoding=utf-8 | |
"" Plugged | |
call plug#begin('~/.vim/plugged') | |
Plug 'tpope/vim-sensible' |
OlderNewer