Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Fullstory
  • Dallas, TX
View GitHub Profile
wget https://raw.githubusercontent.com/osandov/osandov-linux/58e0c5f1bc7f0866ce7a18bcb67f3eabf4be7868/scripts/btrfs_map_physical.c
gcc -O2 -o btrfs_map_physical btrfs_map_physical.c
sudo mount /dev/mapper/data-root /mnt
sudo btrfs sub create /mnt/@swap
sudo umount /mnt
sudo mkdir /swap
sudo mount -o subvol=@swap /dev/mapper/data-root /swap
sudo touch /swap/swapfile
sudo chmod 600 /swap/swapfile
@cstrahan
cstrahan / grb256.py
Created June 21, 2012 22:01
GRB's vim color scheme converted to a pygments style.
# -*- coding: utf-8 -*-
"""
Grb256 Colorscheme
~~~~~~~~~~~~~~~~~~
Converted by Vim Colorscheme Converter
"""
from pygments.style import Style
from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String
@cstrahan
cstrahan / SolarInfo.cs
Created January 6, 2011 05:06
A sunrise/sunset calculator.
using System;
using System.Diagnostics;
namespace SunriseCalculator
{
public class SolarInfo
{
public double SolarDeclination { get; private set; }
public TimeSpan EquationOfTime { get; private set; }
public DateTime Sunrise { get; private set; }
@cstrahan
cstrahan / FirewallHelper.cs
Created August 8, 2010 09:09
C# Firewall helper
///
/// Allows basic access to the windows firewall API.
/// This can be used to add an exception to the windows firewall
/// exceptions list, so that our programs can continue to run merrily
/// even when nasty windows firewall is running.
///
/// Please note: It is not enforced here, but it might be a good idea
/// to actually prompt the user before messing with their firewall settings,
/// just as a matter of politeness.
///
@cstrahan
cstrahan / chicken.rb
Created August 31, 2012 13:50 — forked from tenderlove/chicken.rb
YARV bytecode compiler for Scheme
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
@cstrahan
cstrahan / scala.rb
Created October 23, 2012 14:20
Install Scala on OSX
# to install the latest stable version:
brew install scala --with-docs
# to install scala-2.10.0-RC1:
brew install https://raw.github.com/gist/3939012/scala.rb --with-docs
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands):
brew switch scala 2.9.2
brew switch scala 2.10.0-RC1
@cstrahan
cstrahan / quiz_01.rb
Created December 12, 2012 06:43
Ruby quizes!
# implement the functions `amb` and `assert`.
# `amb` must choose a value from a given set,
# such that all assertions pass.
# as an example, the following program:
a = amb [1,2,3,4,5,6,7]
b = amb [1,2,3,4,5,6,7]
c = amb [1,2,3,4,5,6,7]
# a, b and c must define a legal right triangle:
@cstrahan
cstrahan / HRecursionSchemes.hs
Created November 26, 2018 05:30 — forked from xgrommx/HRecursionSchemes.hs
HRecursionSchemes
{-# LANGUAGE StandaloneDeriving, DataKinds, PolyKinds, GADTs, RankNTypes, TypeOperators, FlexibleContexts, TypeFamilies, KindSignatures #-}
-- http://www.timphilipwilliams.com/posts/2013-01-16-fixing-gadts.html
module HRecursionSchemes where
import Control.Applicative
import Data.Functor.Identity
import Data.Functor.Const
import Text.PrettyPrint.Leijen hiding ((<>))
@cstrahan
cstrahan / zsh.rb
Last active October 22, 2018 01:17
Formula for ZyX's zsh fork. Includes his zsh/zpython module (which might be included in upstream at some point).
require 'formula'
class Zsh < Formula
head "https://bitbucket.org/ZyX_I/zsh.git", :revision => 'abcf1a0ba666119b5aba48f0efd6a2f60acfc3c4'
homepage 'http://www.zsh.org/'
version '5.0.2'
depends_on 'gdbm'
depends_on 'pcre'
depends_on :python
@cstrahan
cstrahan / gist:1975217
Created March 4, 2012 22:49
Emacs Sr Speedbar
(require 'sr-speedbar)
(setq speedbar-frame-parameters
'((minibuffer)
(width . 40)
(border-width . 0)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(unsplittable . t)
(left-fringe . 0)))