Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
sudo wget -S -O /dev/null google.com 2>&1 | sed -n -e 's/ *Date: *//p' -eT -eq | xargs -0 sudo date -s

If GHC complains about base not having profile information, install haskell-platform-prof alongside your Haskell Platform installation:

$ sudo apt-get install haskell-platform haskell-platform-doc haskell-platform-prof

And reinstall any third-party libraries, and their dependencies, that have missing profile information:

$ sudo cabal install --reinstall -p mwc-random rvar random-fu random-source mersenne-random-pure64 stateref flexible-defaults th-extras MonadPrompt math-functions erf vector-th-unbox monad-loops random-shuffle MonadRandom

@mcandre
mcandre / 2-bean-salsa.md
Last active October 17, 2017 00:20
2 Bean Salsa
@bgentry
bgentry / gist:fd1ffef7dbde01857f66
Last active March 25, 2020 17:56
Using gofmt or goimports on only my own Go files (excluding vendored deps)

In Travis CI, I want to check that my Go files are formatted properly via gofmt and goimports. During my CI builds, I only care about formatting issues in my own code, not in third-party repos.

Unfortunately, running a simple gofmt -l . in the root of my project does not work because I'm using Godep, which checks in all of my external dependencies at ./Godep/_workspace. While running go fmt ./... ignores underscore-prefixed subdirectories, the plain gofmt . does not. Neither gofmt nor goimports take the ./... arg:

➜  goimports -l ./...      
stat ./...: no such file or directory

Since I can use go list ./... to get a list of all subpackages in my project (exluding vendored imports in an underscore-prefixed directory), I'm using the following to run gofmt and goimports on each of my own Go files (including _test.go files):

Mac OS X:

$ sed -i '' -e '$a\' <file>

*nix:

sed -i -e '$a\'
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule

On newer computers, RVM may have trouble building older Rubies. E.g., rvm 1.26 cannot build ruby-1.9 on Mac OS X 10.10 Yosemite.

However, by adding a compiler flag, we can successfully build and use these old Rubies:

$ rvm install 1.9 --with-gcc=clang
...
$ rvm use 1.9
@mcandre
mcandre / enchilada-casserole.md
Last active October 17, 2017 00:19
Enchilada Casserole
@mcandre
mcandre / public-trackers.md
Last active January 21, 2025 19:02
List of public BitTorrent tracker announce URLs