Skip to content

Instantly share code, notes, and snippets.

gzagatti /
Last active May 2, 2018
Break tmux pane to background

from Stack Exchange

Break tmux pane

Select target pane and enter Prefix-:

break-pane -dP
gzagatti /
Created Mar 4, 2016
Creating a github repo from the command line and setting up https protocol
  • create a repo via the command line: hub create
  • it's possible to connect with github via a number of protocols, like ssh and https. In order to have https as the default: git config --global hub.protocol https
  • in order to push to a given repo once 2FA is activated via https, it's necessary to generate an access token and use that as the password instead of the login password for the user
gzagatti /
Created Mar 5, 2016
List devices in the network

In order to find devices connected to the same network use: arp -a -n

gzagatti /
Last active Nov 21, 2020
Set up time machine with sparse bundles on NAS drivers

Time Machine Backup w/ Sparse Bundles

  1. create a sparse image: hdiutil create -size 600g -type SPARSEBUNDLE -fs "HFS+J" NAME_XXXXXXX.sparsebundle -volname 'untitled' -encryption
  • ideally the sparse bundle should have about twice the size of your Mac's storage
  1. copy sparse bundle to the network and then mount it: rsync -aE NAME_XXXXXXXXXXXX.sparsebundle /Volumes/DRIVE/.
  2. remove the sparse bundle from machine: rm -rf NAME_XXXXXXXXXXXX.sparsebundle
  3. tell time machine to backup your mounted drive: sudo tmutil setdestination /Volumes/TimeMachine
  4. head to System preferences, then open Time Machine settings; you should see your virtual drive as the default backup destination
gzagatti /
Last active May 23, 2016
Solve ft_render error in octave, by installing fontconfig with universal support. Gnuplot makes use of fontconfig to display fonts.

In order to install octave with support for free type fonts when plotting it is necessary to install fontconfig with universal access, which builds a universal binary. Otherwise the following error is returned:

warning: ft_render: unable to load appropriate font
warning: could not match any font: *-normal-normal-10

Gnuplot makes use of fontconfig to display fonts. So first install fontconfig: brew install fontconfig --universal. Then install gnuplots: brew install gnuplots --with-qt, the flag --with-qt refers to the gui interface which you're willing to use

gzagatti /
Created Mar 14, 2016
Available commands in node.js REPL

Node.js REPL

Special REPL commands:

  • .break/<ctrl>C: breaks multi-line expressions
  • .clear: resets the context
  • .exit/<ctrl>D: close the I/O stream; causes the REPL to exit
  • .help: show this list of special commands
  • .save: save the current REPL session
  • .load: load a file int the current REPL session
  • tab: show both global and local scope variables
gzagatti /
Last active Mar 17, 2016
Apache VHosts and Dnsmasq set up

Local Development with Apache VHosts and Dnsmasq

  1. setting up apache
    • when setting up the VHosts, it's necessary to comment out the example config otherwise we get warnings that a given folder was not found
  2. setting up Dnsmasq

Apache tools

  • apachectl start / apachectl stop / apachectl restart: turn on/off apache server
  • apachectl configtest: test apache configuration
gzagatti / increase_match.vim
Created Mar 20, 2016
Increase digit by 1 in vim match
View increase_match.vim
gzagatti / matplotlibrc
Created May 2, 2016 — forked from huyng/matplotlibrc
my default matplotlib settings
View matplotlibrc
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
gzagatti / vnew_full_length.vim
Created Jun 24, 2016
Open a new file splitting the window vertical and occupying the full height of the window