Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block antoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Keybase identity proof
### Keybase proof
I hereby claim:
* I am antoni on github.
* I am antoni ( on keybase.
* I have a public key ASAPlJzPyid_8vQoMmG2Dj5nzdugiKAYEtNIAJFGIA0AFgo
To claim this, I am signing this object:
View gist:ab29e5d2a9aee3aeea41
# Move code from one repo to another, preserving commit history
# Source:
cd repo2
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master
git remote rm r1remote
# Push to master without having to --set-upstream-to first
antoni /
Created Mar 18, 2019 — forked from webframp/
Signing git commits on github using gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

antoni /
Created Jan 6, 2019 — forked from cowboy/
Bash: Sudo keep-alive (good for long-running scripts that need sudo internally but shouldn't be run with sudo)
# Might as well ask for password up-front, right?
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Example: do stuff over the next 30+ mins that requires sudo here or there.
function wait() {
#!/usr/bin/env bash
: ' Usage:
bash <(wget --quiet --output-document=-
# Replaces $1 with $2 in the origin named 'origin' of Git repo
# Should be executed from inside of the repository folder
function replace_in_origin() {
View gist:a98b6e4b7ecea3b0374faa95cd3a5d6a
### Keybase proof
I hereby claim:
* I am antoni on github.
* I am antoni ( on keybase.
* I have a public key ASBjyuQy5Z1RKEScj1d1U_KBa_wNzjunfSWleyf_ITIoLAo
To claim this, I am signing this object:
antoni /
Created Feb 11, 2018 — forked from Starefossen/
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.


New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
antoni / json_stringify_once.js
Created Aug 1, 2017
Dumps an object in JSON. Works with circular JSON structures
View json_stringify_once.js
// Dumps an object in JSON. Works with circular structures like:
// var o = {};
// o.o = o;
JSON.stringifyOnce = function(obj, replacer, indent){
var printedObjects = [];
var printedObjectKeys = [];
function printOnceReplacer(key, value){
if ( printedObjects.length > 2000){ // browsers will not print more than 20K, I don't see the point to allow 2K.. algorithm will not be fast anyway if we have too many objects
View stdc++.h
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
antoni / custom_json.go
Created Jul 12, 2017 — forked from mdwhatcott/custom_json.go
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground:
View custom_json.go
package main
import (
func main() {
You can’t perform that action at this time.