Skip to content

Instantly share code, notes, and snippets.

View dsabanin's full-sized avatar
It's Complicated

Dmitry Sabanin dsabanin

It's Complicated
View GitHub Profile
dsabanin /
Created August 7, 2021 15:32 — forked from nickcernis/
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
dsabanin /
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/
sudo touch /Applications/
# Don't forget to restart Xcode
dsabanin / start.ts
Last active April 18, 2023 09:08
Electron auto-update startup fix
// The idea here is to make sure that ShipIt process that copies the updated app exits
// before we launch the new version. The code below checks if the update is still in progress,
// which means that we are running the old app still, it keeps checking until ShipIt exits and restarts
// the app hoping that a new version will start up at that time.
// "find-process": "~1.2.1",
import findProcess from 'find-process';
const BUNDLE_NAME = 'com.myorganization.bundleName';
const SHIP_IT_BINARY = 'ShipIt';
dsabanin /
Created July 5, 2016 14:28
Keybase proof

Keybase proof

I hereby claim:

  • I am dsabanin on github.
  • I am dsabanin ( on keybase.
  • I have a public key ASCR4oyyMHmDzrg6nI3aHvWXodl8NimeCb3qxTnv7qscywo

To claim this, I am signing this object:

dsabanin /
Last active August 29, 2015 14:07
Tiny capistrano-like script for
# Execute as ./ /data/project 19851203123502
# It will deploy final release as a symlink from /data/project/current to /data/project/releases/19851203123502
mkdir -p $BASE/releases $BASE/shared $BASE/logs
cp -al $BASE/deploy-cache $RELEASE
dsabanin /
Created May 23, 2014 14:55
Script for setting up redirect for a local port to a remote host's port (root or sudo needed)
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $PROXY_PORT -j DNAT --to $TARGET_HOST:$TARGET_PORT
iptables -t nat -A PREROUTING -p tcp --dport $PROXY_PORT -j DNAT --to $TARGET_HOST:$TARGET_PORT
dsabanin / raise-on-match.clj
Last active December 24, 2015 00:39
(defmacro raise-on-match
[matches & body]
(loop [matches (->> matches (partition-all 2) (reverse))
res `(do ~@body)]
(when matches
(recur (rest matches)
`(raise-on ~(first matches) ~res)))
;; Usage
def diffs(repo, from, to)
repo.call_git("diff ?..?", from, to).stdout.
split(/diff --git.*?$/).
map { |d| d.blank? ? nil : d }.
map { |d| [diff_head(d), d] }
(def first (fn [first]
(fn [second] first)))
(def second (fn [first]
(fn [second] second)))
(def make-pair (fn [first] (fn [second] (fn [func] ((func first) second)))))
(def TRUE first)
(def FALSE second)
dsabanin / gist:5860527
Created June 25, 2013 17:36
Useful strace command
strace -qfFxv -s 1024 -p PROCESS-PID