Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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
@gzagatti
gzagatti / kill_port.sh
Created June 27, 2016 15:57
Kill process using port 3000
lsof -t -i :3000 | xargs kill -9
@gzagatti
gzagatti / ipython_session.md
Created June 29, 2016 15:26
Start an ipython console with linked with an existing notebook

When you start the ipython notebook in the terminal, it will output something like this:

2015-03-26 13:05:52.772 [NotebookApp] Kernel started: 4604c4c3-523b-4373-bfdd-222eb1260156 Then start the ipython console like this:

ipython console --existing 4604c4c3