Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
@vitorbritto
vitorbritto / rm_mysql.md
Last active April 16, 2026 20:35
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@mcandre
mcandre / git-checkout-a-tag.md
Last active April 21, 2020 22:03
"Checkout a tag" in Git

How to "checkout a tag" in Git:

Purists will whine that you can't technically checkout a tag in Git; instead, you checkout a branch at a start point, which may be a tag.

Assuming the desired tag is v1.0, you can tell Git to create a new branch, also named v1.0, at the point in Git history where the tag is v1.0:

project (master)$ git checkout tags/v1.0 -b v1.0
project (v1.0)$
@mcandre
mcandre / LambdaTest.java
Created January 19, 2015 17:25
Java 8 Lambda test
import java.util.List;
import java.util.ArrayList;
import java.util.stream.Stream;
import java.util.stream.Collectors;
public class LambdaTest {
public static void main(String[] args) {
ArrayList<Integer> xsList = new ArrayList<Integer>();
for (Integer i = 0; i < 10; i++) {
@mcandre
mcandre / public-trackers.md
Last active April 13, 2026 21:13
List of public BitTorrent tracker announce URLs
@mcandre
mcandre / enchilada-casserole.md
Last active October 17, 2017 00:19
Enchilada Casserole

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
@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

Mac OS X:

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

*nix:

sed -i -e '$a\'
@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):

@mcandre
mcandre / 2-bean-salsa.md
Last active October 17, 2017 00:20
2 Bean Salsa