Skip to content

Instantly share code, notes, and snippets.


Mislav Marohnić mislav

View GitHub Profile
mislav / keybindings.json
Last active Jun 18, 2021
VS Code keyboard shortcut for quickly re-running the Go test under development. Requires VS Code Go 0.26+
View keybindings.json
// > Preferences: Open Keyboard Shortuts (JSON)
"key": "shift+enter",
"command": "go.test.cursorOrPrevious",
"when": "editorTextFocus && editorLangId == 'go' && !findInputFocused && !replaceActive"
"key": "ctrl+shift+enter",
"command": "go.test.package"
mislav / workflows-automerge.yml
Last active Jul 18, 2021
Using GitHub CLI from GitHub Actions
View workflows-automerge.yml
name: Auto-merge
types: [opened]
runs-on: ubuntu-latest
# Usage: bash <source-repo> <destination-repo> <label-names>...
# Requirements: GitHub CLI, jq
# Example:
# brew install gh jq
# bash owner/repo1 owner/repo2 "bug" "help wanted" "feature"
set -e
# First, close Google Chrome.
# unload the Keystone agent
find /Library/Launch* ~/Library/LaunchAgents -maxdepth 1 -iname '*' | xargs -L1 launchctl unload
# prevent it from starting again (note: you could also back up the files by moving them elsewhere)
find /Library/Launch* ~/Library/LaunchAgents -maxdepth 1 -iname '*' | xargs rm -v
# Warning: it's likely that running Google Chrome after this will restore these files.
# If it doesn't, consider that automatic Chrome updates will be DISABLED. Use at own risk.
mislav / gh-rename-master
Last active Feb 3, 2021
Rename the default branch of a repository using GitHub CLI
View gh-rename-master
# Usage: gh-rename-master <newbranch> [<remote>]
# Renames the "master" branch of the current repository both locally and on GitHub.
# dependencies: GitHub CLI v0.10
set -e
mislav /
Created Apr 15, 2020
GraphQL mutation example with hub & jq
jq -R --slurp '{query: ., variables: {input: $ARGS.named}}' \
--arg name "hello-world" \
--arg visibility "PRIVATE" \
--arg ownerId "<ORG-NODEID>" \
--arg teamId "<TEAM-NODEID>" \
mutation ($input: CreateRepositoryInput!) {
createRepository(input: $input) {
repository {
mislav /
Created Oct 30, 2019
Download `bin/hub` for the current environment
set -e
latest-version() {
curl -fsi | awk -F/ '/^Location:/ {print $(NF)}'
if [ -z "$HUB_VERSION" ]; then
latest=$(latest-version) || true
mislav /
Last active Apr 27, 2020
hub api example of how to fetch all comments over GraphQL
comments() {
local issue="${1?}"
shift 1
paginate hub api --cache 3600 graphql -F issue="$issue" "$@" -f query='
query ($owner: String = "{owner}", $repo: String = "{repo}", $issue: Int!, $per_page: Int = 30, $after: String) {
repository(owner: $owner, name: $repo) {
issueOrPullRequest(number: $issue) {
... on Issue {
comments(first: $per_page, after: $after) {
mislav / MultiLinkedList.sol
Created Oct 5, 2018 — forked from benzap/MultiLinkedList.sol
Multi Linked List Implementation in Solidity
View MultiLinkedList.sol
pragma solidity ^0.4.24;
Multiple Linked List Storage
Dynamic Storage Contract for storing multiple linked lists each
uniquely identified by a key. Implementation allows for
mislav / untar.go
Created Oct 24, 2017
Go program to untar multiple gzipped tarballs listed on the command line
View untar.go
package main
import (