Skip to content

Instantly share code, notes, and snippets.

View sohocoke's full-sized avatar

sohocoke

View GitHub Profile
@sohocoke
sohocoke / tm-recover.zsh
Last active September 3, 2019 12:01
Copy a file from a bunch of Time Machine backup directories.
#! /bin/zsh
# Copy a file from a bunch of TM backup sets.
# --
# This a rough-and-ready alternative to using the Time Machine UI to find and
# recover the right version of a file, which can take an eternity with networked
# backup volumes.
# tweak the values and run in a terminal app that has full disk access permissions.
@sohocoke
sohocoke / .rubocop.yml
Created April 6, 2019 18:20
My default rubocop config
# i hope the default rubocop settings are designed to have everything
# turned on so you become aware of their existence, rather than someone's idea
# of how linting can prevent monkeys from attempting to type in Shakespear on
# a programmer's keyboard.
#
# changing default config to turn off all the warnings with low or no value.
Layout/TrailingWhitespace:
Enabled: false
Layout/SpaceAfterComma:
@sohocoke
sohocoke / hold-esc-to-cmd-w.json
Last active June 4, 2018 15:37
Karabiner-elements rule to remap press-hold ESC to cmd-W
{
"title": "Hold Keys",
"rules": [
{
"description": "Hold Esc to cmd+W",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape"

Configuring Sublime Text 3 with pyenv

Context

Wanted to try out some Python NLP packages, found API discovery in Jupyter less than ideal.

Problem

Sublime Text 3 gave me a headache because it didn't pick up the default Python version I set using [pyenv].

Solution

  • Ensure pyenv works and is set up to use your default Python version of choice.
# # Fixing key bindings for `irb`
#
# when your ruby comes from `brew`, `rbenv`, and arrow keys don't work in your `irb`
brew upgrade readline rbenv ruby-install # ensure we have the `readline` library, and a recent version of `ruby-install` which will link to it properly when building `ruby`.
rbenv install <your-favourite-ruby-version> # rebuild ruby.
# watch out for the message 'ruby-build: use readline from homebrew' in output from the command above,
# then, go get some coffee.
# ...
@sohocoke
sohocoke / cont_all_paused.sh
Created January 12, 2017 06:50
macOS CLI one-liner to resume all processes stuck in 'paused' state, typically after running out of disk space
#!/usr/bin/env bash
ps aux | grep Ss | awk '{ print $2 }' | xargs -- kill -CONT
# TODO improve the crude filter for 'Ss'
# TODO filter for username
# IMPROVE add an option for interactive operation (list, then perform)
# ## one-liners
# ## - one-liner workflows.
Let's hypothesise on a design of a coding tool that you can use on your iPhone you carry around every day.
It can't be a text editor, since on a touch screen, the keyboard is hardly a productive tool of input.
### basic scenarios.
## standard boilerplate.
class AppDelegate
def applicationDidFinishLaunching(notification)
buildMenu
buildWindow
Story.begin
end
end
@sohocoke
sohocoke / SassMeister-input-HTML.html
Last active August 29, 2015 13:55
Generated by SassMeister.com.
<div class="page65">
<div></div>
<h2>section one</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<div></div>
<h2>section two</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, rema
@sohocoke
sohocoke / brunch-slim-compilation-config-snippet.coffee
Last active January 4, 2016 07:49
brunch config snippet to enable slim compilation on save.
# add the afterBrunch npm package and setup afterBrunch like the following.
plugins:
afterBrunch: [
''' # compile slim files
ruby <<EOF
path = 'app'
Dir.glob("app/**/*.slim")do |file|
target = file.gsub( /\.slim$/, '').gsub(%r(^app\/assets), '_public')
system "slimrb #{file} #{target}"
end