Skip to content

Instantly share code, notes, and snippets.

View jimeh's full-sized avatar

Jim Myhrberg jimeh

View GitHub Profile

Alternative Accounts

Below is a list of alternative GitHub accounts which I (@jimeh) use, and have full control over.

Verification

This document was GPG signed with:

@jimeh
jimeh / domain-finder.go
Created November 15, 2022 17:27
domain-finder.go
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"sync"
)
/* ==UserStyle==
@name GitHub Dark Diff Color Customizer (customized)
@namespace StylishThemes
@version 2.0.4-custom
@description A diff color customization style, colorblind friendly by default
@author StylishThemes and contributors
@homepageURL https://github.com/StylishThemes/Feature-Override-Styles/
@supportURL https://github.com/StylishThemes/Feature-Override-Styles/issues/new/choose
@updateURL https://gist.githubusercontent.com/jimeh/57b7e6e6e0107036c167f10f87a55861/raw/github-dark-diff-color-customizer.css
@license MIT

RSpec Hook Order

The following is a quick reference to exact order of hook execution in RSpec. The output from hook_spec.rb is:

describe: "a thing"
  -> before: all (top)
    -> around: before (top)
      -> before: each (top)
        -> example: "success" (top)
@jimeh
jimeh / wait-for.sh
Last active May 25, 2023 09:15
wait-for.sh
#!/bin/sh
[ -n "$DEBUG" ] && set -x
check_http() {
wget -T 1 -S -q -O - "$1" 2>&1 | head -1 |
grep -E 'HTTP.+\s2[0-9]{2}' > /dev/null 2>&1
return $?
}
check_tcp() {
@jimeh
jimeh / bluetooth_sleep.lua
Created January 29, 2019 01:16 — forked from ysimonson/bluetooth_sleep.lua
Hammerspoon script to disable bluetooth when the computer is put to sleep. Requires `blueutil` to be installed (`brew install blueutil`).
function bluetooth(power)
print("Setting bluetooth to " .. power)
result = hs.execute("blueutil --power " .. power)
if result.rc ~= 0 then
print("Unexpected result executing `blueutil`: rc=" .. result.rc .. " type=" .. result.type .. " output=" .. result.output)
end
end
function f(event)
@jimeh
jimeh / .rubocop.yml
Last active September 18, 2017 11:20
Error in Rubocop 0.50.0's Style/SafeNavigation cop
AllCops:
TargetRubyVersion: 2.4
# Let hubot chime in on certain discussions...
module.exports = (robot) ->
robot.hear /rewrite/i, (msg) ->
if shouldSpeak(0.1)
msg.send("#{msg.random(rewriteImages)}#.png")
robot.hear /refactor/i, (msg) ->
if shouldSpeak(0.1)
@jimeh
jimeh / tmux.rb
Created May 13, 2016 13:32
Seemingly working Homebrew formula for Tmux 2.2.
class Tmux < Formula
desc "Terminal multiplexer"
homepage "https://tmux.github.io/"
stable do
url "https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz"
sha256 "bc28541b64f99929fe8e3ae7a02291263f3c97730781201824c0f05d7c8e19e4"
end
head do
@jimeh
jimeh / chat.go
Created September 28, 2015 08:56
simple golang chat server
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string