Skip to content

Instantly share code, notes, and snippets.

@gzagatti
gzagatti / tmux_break_pane.md
Last active May 2, 2018 03:14
Break tmux pane to background

from Stack Exchange

Break tmux pane

Select target pane and enter Prefix-:

break-pane -dP
@gzagatti
gzagatti / create_repo_github.md
Created March 4, 2016 08:44
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
gzagatti / devices_network.md
Created March 5, 2016 10:47
List devices in the network

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

@gzagatti
gzagatti / time_machine_backup.md
Last active November 21, 2020 17:20
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
gzagatti / octave_font_support.md
Last active May 23, 2016 01:56
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
gzagatti / nodes_repl.md
Created March 14, 2016 10:12
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
gzagatti / apache_setup.md
Last active March 17, 2016 19:30
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
gzagatti / increase_match.vim
Created March 20, 2016 11:44
Increase digit by 1 in vim match
%s/\d\+/\=(submatch(0)+1)/g
@gzagatti
gzagatti / matplotlibrc
Created May 2, 2016 20:45 — forked from huyng/matplotlibrc
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# 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
gzagatti / vnew_full_length.vim
Created June 24, 2016 00:59
Open a new file splitting the window vertical and occupying the full height of the window
:botright vsplit