Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
@jonjack
jonjack / git-show-branch-info.sh
Created April 6, 2022 11:46
Display textual history of all commits in Git branch.
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
@jonjack
jonjack / vs-code-command-code-runner-run-not-found-fix.md
Last active September 26, 2021 21:17
Visual Studio code - command 'code-runner.run' not found fix for formulahendry.code-runner-0.9.10

Program: Visual Studio Code
Extension: Code Runner 0.9.10 (code-runner-0.9.10)
Problem: When attempting to run a script/program, VS Code reports error: "command 'code-runner.run'"
Fix: Manually edit extension code.

Edit extension file codeManager.js
On macOS this is usually at ~/.vscode/extensions/formulahendry.code-runner-0.9.10/out/src/codeManager.js

Comment out line 12.

@jonjack
jonjack / mysqlworkbench-8.0.22.rb
Last active June 22, 2021 12:12
Homebrew mysqlworkbench 8.0.22 cask formula for Big Sur
cask "mysqlworkbench-8.0.22" do
version "8.0.22"
sha256 "4e27de82d869043cf80e803f1a57cc041a91cabddf0aa6a6c054d68af1837d48"
url "https://downloads.mysql.com/archives/get/p/#{version.major}/file/mysql-workbench-community-#{version}-macos-x86_64.dmg"
name "MySQL Workbench"
desc "Visual tool to design, develop and administer MySQL servers"
homepage "https://www.mysql.com/products/workbench/"
app "MySQLWorkbench.app"
@jonjack
jonjack / mysqlworkbench-8.0.25.rb
Last active June 22, 2021 12:10
Homebrew mysqlworkbench 8.0.25 cask formula for Big Sur
cask "mysqlworkbench-8.0.25" do
version "8.0.25"
sha256 "8da15d32d0c3cc8d43e49f8d3580ddec0d8dcd718153da7c934acf26f83ea0c5"
url "https://cdn.mysql.com/Downloads/MySQLGUITools/mysql-workbench-community-#{version}-macos-x86_64.dmg"
livecheck do
url "https://dev.mysql.com/downloads/workbench/"
strategy :page_match
regex(/MySQL\s*Workbench\s*(\d+(?:\.\d+)*)/i)
end

Assumes you have brew installed.

Install pyenv.

brew install pyenv

Check what versions of python are available.

@jonjack
jonjack / git-scraps.md
Last active March 8, 2021 22:54
Git scraps

Comparing commits

To compare last two commits.

git diff HEAD^ HEAD

Since comparison with HEAD is the default you can omit it for even shorter syntax.

@jonjack
jonjack / osx-brew-install-not-symlinked-chown-user-local.md
Last active November 24, 2020 12:43
cannot complete brew install, not symlinked into /usr/local, requires me to chown /usr/local

While installing some formula I get:-

The formula built, but is not symlinked into /usr/local

Running brew as root is not allowed.

sudo brew install awscli
if (tweeted || facebooked) {
gratitude += 1;
}
if (githubStarred) {
karmaBalance = true;
} else {
$('we').say('ok');
}
import org.joda.time.LocalTime;
public class Timer {
public static void main(String[] args) {
LocalTime start = LocalTime.now();
// some event to be timed
LocalTime end = LocalTime.now();
int delta = end.getMillisOfDay() - start.getMillisOfDay();
System.out.println("Time took: " + Double.valueOf(delta)/1000 + " seconds");
}