Skip to content

Instantly share code, notes, and snippets.

View lanzafame's full-sized avatar

Adrian Lanzafame lanzafame

View GitHub Profile

Keybase proof

I hereby claim:

  • I am Lanzafame on github.
  • I am lanzafame (https://keybase.io/lanzafame) on keybase.
  • I have a public key whose fingerprint is EF20 ADEC 164F 872B 23A2 EF3B BD9F 078F 3E60 560B

To claim this, I am signing this object:

if test -n $HOME
set -l NIX_LINK $HOME/.nix-profile
if test ! -L $NIX_LINK
echo "creating $NIX_LINK" >&2
set -l _NIX_DEF_LINK /nix/var/nix/profiles/default
/nix/store/cdybb3hbbxf6k84c165075y7vkv24vm2-coreutils-8.23/bin/ln -s $_NIX_DEF_LINK $NIX_LINK
end
set -x PATH $NIX_LINK/bin $NIX_LINK/sbin $PATH
@lanzafame
lanzafame / ssh_agent_start.fish
Last active April 23, 2016 05:04 — forked from rsff/ssh_agent_start.fish
ssh agent for fish
#this script can never fail
#i use it in the fish_config
#call it with start_agent
setenv SSH_ENV $HOME/.ssh/environment
function ssh_agent_start
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
@lanzafame
lanzafame / touchfileinalldirs.bash
Created June 6, 2016 01:43
Create file in all the directories in the current directory.
# Create __init__.py in all the directories in the current directory.
# .
# ├── clique
# │   └── clique.py
# ├── __init__.py
# ├── metro
# │   └── metro.py
# ├── pop
# │   └── pop.py
# ├── service
@lanzafame
lanzafame / auth.py
Created June 14, 2016 02:28 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@lanzafame
lanzafame / pr.md
Created June 15, 2016 00:32 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@lanzafame
lanzafame / check.go
Last active June 17, 2016 01:44 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); err == nil {
// path/to/whatever exists
}
@lanzafame
lanzafame / nmcli-toggle.py
Last active July 11, 2016 06:37 — forked from un-def/nmcli-toggle.py
Toggle network connection up/down using nmcli
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import subprocess
if len(sys.argv) < 2:
print("Usage: nmcli-toggle.py connection_id")
sys.exit()
conn_id = sys.argv[1]
active = subprocess.check_output(['nmcli', 'connection', 'show', '--active'])
up_down = ('up', 'down')[bytes(conn_id, 'utf-8') in active]
@lanzafame
lanzafame / error output - ipfs
Last active March 15, 2018 03:15
Docker build gx issues (MacOS)
$ docker build .
...
gx install --global
/bin/sh: 1: gx: Exec format error
mk/gx.mk:4: recipe for target 'gx-deps' failed
make: *** [gx-deps] Error 2
The command '/bin/sh -c cd $SRC_DIR && mkdir .git/objects && ([ -z "$GX_IPFS" ] || echo $GX_IPFS > /root/.ipfs/api) && make build' returned a non-zero code: 2
@lanzafame
lanzafame / blockstack
Created April 11, 2018 05:55
Blockstack
Verifying my Blockstack ID is secured with the address 15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE https://explorer.blockstack.org/address/15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE