Skip to content

Instantly share code, notes, and snippets.

@timmytofu
timmytofu / ghcPkgUtils.sh
Last active June 6, 2020 12:02 — forked from simonmichael/gist:1185421
ghc-pkg-clean and ghc-pkg-reset compatible with both zsh and bash
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@jda0
jda0 / farkle.c
Last active June 17, 2016 06:24
Super Awful C to keep scores in a game of Farkle.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Copyright James Daly 2014
// Compile with: gcc farkle.c -std=c99 -o farkle
typedef struct Leader
{
char name[16];
@juliaferraioli
juliaferraioli / Julia-on-GCE-2
Created January 23, 2014 08:38
Import data from Google Cloud Storage, save locally, produce png, and save to Google Cloud Storage.
Pkg.add("Gadfly")
Pkg.add("HTTPClient")
Pkg.add("JSON")
Pkg.add("RDatasets")
using Gadfly
using HTTPClient.HTTPC
using JSON
using RDatasets
require 'formula'
class RDownloadStrategy < SubversionDownloadStrategy
def stage
quiet_safe_system 'cp', '-r', @clone, Dir.pwd
Dir.chdir cache_filename
end
end
class R < Formula
import numpy as np
from numba import jit
def root_func(x):
return x**4 - 2*x**2 - x - 3
def compile_specialized_bisect(f):
"""
Returns a compiled bisection implementation for ``f``.
"""
@cuibonobo
cuibonobo / kivent_install.md
Created September 18, 2014 02:00
Installing KivEnt on Mac OS X.

Tested on Mac OS X 10.8.5 and 10.9.3.

Not for the faint of heart. Before we begin, you will need to install XQuartz, Homebrew, and virtualenv.

I'm using virtualenv to isolate your global system settings from the KivEnt installation because it's still under heavy development and it's very messy. We'll also be using the virtual environment folder to install Kivy, Cymunk, and KivEnt without needing to add them to your repository or your .gitignore file.

Now follow these steps carefully and you should be up and running:

  • Gain access to homebrew-headonly with brew tap homebrew/headonly. You may want to do a brew update for good measure.
  • SMPEG was moved to homebrew-headonly, so install it with brew install --HEAD smpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carlobaldassi
carlobaldassi / PartSort.jl
Last active August 29, 2015 14:18
partial select
module PartSort
using Base.Order
import Base: sort!, Sort.Algorithm
export PartialQuickSort
immutable PartialQuickSort <: Algorithm
k::Int
@jaibeee
jaibeee / brew-perms.sh
Last active January 4, 2025 01:23
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew