Skip to content

Instantly share code, notes, and snippets.

View dcorking's full-sized avatar

David Corking dcorking

View GitHub Profile
@skyzyx
skyzyx / homebrew-gnubin.md
Last active April 23, 2026 16:40
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@dcorking
dcorking / hide-hnq-everywhere.css
Created March 6, 2019 14:48
Hide Hot Network Questions everywhere (to aid concentration)
/* for use as a user style, for example in a browser extension like Stylus for Google Chrome */
#hot-network-questions {
display: none
}
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 29, 2026 15:36
set -e, -u, -o, -x pipefail explanation
@mrmartineau
mrmartineau / stimulus.md
Last active April 25, 2026 07:43
Stimulus cheatsheet
@Andy-Bell
Andy-Bell / .eslintrc.json
Created December 22, 2017 13:47
My minimal eslint
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
@brickgale
brickgale / .htaccess
Last active January 28, 2022 16:24
Laravel force https for Heroku
#add this on public/.htaccess for Laravel
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@dcorking
dcorking / rails_helper.rb
Last active May 17, 2017 07:58
rails_helper or spec_helper snippet to trace the clock before and after each rspec example
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
# ...
RSpec.configure do |config|
# Can help you spot problems with system time, timezones and time travel,
# especially if multiple specs interact with each other
# Check this doc for the difference between ::now and ::current :
# http://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to
config.around(:each) do |example|
puts "Time.now: #{Time.now}"
@dcorking
dcorking / roassal-mondrian-movie-recommendations.st
Created May 6, 2017 08:07
interactive cluster graph (spider web) visualization of TMDb movie recommendations
"
For a workspace (aka playground)
Works in a Moose 6.0 image
dcorking, 2017, public domain Creative Commons CC0
"
path := '/Users/dcorking/workspace/tmdb-ruby-play/nodes.csv'.
stream := FileStream readOnlyFileNamed: path.
string := stream contents.
@iisaint
iisaint / connect_unlockAccount.js
Created March 1, 2017 05:26
Connect to a parity node
/*
* connect to ethereum node
*/
const ethereumUri = 'http://localhost:8540';
const address = '0x004ec07d2329997267Ec62b4166639513386F32E'; // user
let web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider(ethereumUri));
if(!web3.isConnected()){
@iisaint
iisaint / connect.js
Created March 1, 2017 05:21
Using node.js to connect to parity node
const Web3 = require('web3');
/*
* connect to ethereum node
*/
const ethereumUri = 'http://localhost:8540';
let web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider(ethereumUri));