Skip to content

Instantly share code, notes, and snippets.

View ford-prefect's full-sized avatar

Arun Raghavan ford-prefect

View GitHub Profile
@ford-prefect
ford-prefect / seed.rb
Created November 28, 2014 05:04
seed brew formula
require "formula"
class Seed < Formula
homepage "https://wiki.gnome.org/action/show/Projects/Seed"
url "https://github.com/GNOME/seed.git", :revision => "0b2df4d5b17f1034a058cd8d0069807a3cefeba1"
version "3.8.1-git0b2df4"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
@ford-prefect
ford-prefect / openssl-compile.log
Created March 10, 2015 10:00
openssl-compile.log (failure on armv7s)
making all in crypto...
/usr/bin/perl ../util/mkbuildinf.pl "clang -I. -I.. -I../include -arch armv7s -mcpu=cortex-a9 -pipe -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -miphoneos-version-min=6.0 -Wall -g -Os -Wno-error=format-nonliteral -Wno-error=implicit-function-declaration -fPIC -DOPENSSL_PIC" "BSD-generic32" >buildinf.h
clang -I. -I.. -I../include -arch armv7s -mcpu=cortex-a9 -pipe -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -miphoneos-version-min=6.0 -Wall -g -Os -Wno-error=format-nonliteral -Wno-error=implicit-function-declaration -fPIC -DOPENSSL_PIC -arch armv7s -mcpu=cortex-a9 -pipe -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -c -o cryptlib.o cryptlib.c
clang -I. -I.. -I../include -arch armv7s -mcpu=cortex-a9 -pipe -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platfor
@ford-prefect
ford-prefect / gist:cd2ef0b3e17b3b9c15d9
Created March 10, 2015 20:01
osxaudio review todo
audiounitinitialize on open - test on OS X and iOS
get_caps - okay
cached_caps_valid - take lock in property notification only if on outer element
can we just use cached_caps == NULL for marking invalid?
with/without channel-mask in caps - keep both, since we want to expose what the
device has, and also allow remapping
- if !channel_mask, we're adding duplicate
structures
- out_s1 should be before out_s2
G_STRUCT_OFFSET - maybe just add a single line note like:
http://www.berkshirehathaway.com/letters/2014ltr.pdf#page=23#b03g17t20w15
The unconventional, but inescapable, conclusion to be drawn from the past fifty years is that it has been far safer to invest in a diversified collection of American businesses than to invest in securities – Treasuries, for example – whose values have been tied to American currency. That was also true in the preceding half-century, a period including the Great Depression and two world wars. Investors should heed this history. To one degree or another it is almost certain to be repeated during the next century
Stock prices will always be far more volatile than cash-equivalent holdings. Over the long term, however, currency-denominated instruments are riskier investments – far riskier investments – than widely-diversified stock portfolios that are bought over time and that are owned in a manner invoking only token fees and commissions. That lesson has not customarily been taught in business schools, where volatility is almost universal
import Data.Char
rot13 :: String -> String
rot13 s = case length s of
0 -> ""
1 -> [rot13c (head s)]
_ -> rot13c (head s) : rot13 (tail s)
where
rot13c c
| isAsciiLower c = rot13b 'a' c
@ford-prefect
ford-prefect / .vimrc
Created September 27, 2016 16:21
.vimrc as of 27/9/2016
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 Sep 19
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
@ford-prefect
ford-prefect / tax.py
Last active February 1, 2017 10:32
income tax plotter
import matplotlib.pyplot as plt
import numpy as np
def tax(income):
income *= 1000
tax = 0
taxable = income
# 0-2.5L - 0%
@ford-prefect
ford-prefect / hacking-pulse.md
Last active March 14, 2024 07:54
Hacking on PulseAudio

Let's take the example of needing to build webrtc-audio-processing with some changes, and then PA against that

Building webrtc-audio-processing

This follows standard the autotools procedure for a prefixed installation:

  • Checkout the code, cd in
  • ./autogen.sh --prefix=${HOME}/prefix/webrtc-audio-processing
  • make && make install
@ford-prefect
ford-prefect / collections.rs
Last active March 28, 2017 13:52
Collections exercise
// Given a list of integers, use a vector and return the mean (average), median (when sorted,
// the value in the middle position), and mode (the value that occurs most often; a hash map
// will be helpful here) of the list.
// Convert strings to Pig Latin, where the first consonant of each word is moved to the end
// of the word with an added “ay”, so “first” becomes “irst-fay”. Words that start with a
// vowel get “hay” added to the end instead (“apple” becomes “apple-hay”).
// Remember about UTF-8 encoding!
fn avg_and_median(v: &Vec<i32>) -> (i32, i32) {
let mut copy = v.clone();
fn largest<T: PartialOrd>(list: &[T]) -> &T {
let mut largest = &list[0];
for i in list.iter() {
if largest < i {
largest = i;
}
}
largest