Skip to content

Instantly share code, notes, and snippets.

Avatar

Adrian Lanzafame lanzafame

View GitHub Profile
View wide-github-prs.css
/*
Remove from this comment when putting the css into Stylus
url regex: /^https?://github\.com/.+?/pull/.*/files.*$/
*/
@media only screen and (min-width: 1900px) {
.file {
width: 1500px;
margin-left: -250px;
}
.comment-holder,
View keybase.md

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 3698 5E8D 36C5 FDE9 D463 45D1 87E4 0C5D 62EA E192

To claim this, I am signing this object:

View git_fzf_key_bindings.fish
function __git_fzf_is_in_git_repo
command -s -q git
and git rev-parse HEAD >/dev/null 2>&1
end
function __git_fzf_git_status
__git_fzf_is_in_git_repo; or return
git -c color.status=always status --short | \
fzf -m --ansi --preview 'git diff --color=always HEAD -- {-1} | head -500' | \
cut -c4- | \
View blockstack
Verifying my Blockstack ID is secured with the address 15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE https://explorer.blockstack.org/address/15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE
View blockstack
Verifying my Blockstack ID is secured with the address 15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE https://explorer.blockstack.org/address/15Tx5vaUVL2oMSW3ygWXxBdTNaQjTjQWCE
@lanzafame
lanzafame / error output - ipfs
Last active Mar 15, 2018
Docker build gx issues (MacOS)
View error output - ipfs
$ 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 / nmcli-toggle.py
Last active Jul 11, 2016 — forked from un-def/nmcli-toggle.py
Toggle network connection up/down using nmcli
View nmcli-toggle.py
#!/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 / check.go
Last active Jun 17, 2016 — forked from mattes/check.go
Check if file or directory exists in Golang
View check.go
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 / pr.md
Created Jun 15, 2016 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

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 / auth.py
Created Jun 14, 2016 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
View auth.py
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