Skip to content

Instantly share code, notes, and snippets.

View fvdm's full-sized avatar
🦖
I may be slow to respond

Franklin fvdm

🦖
I may be slow to respond
View GitHub Profile
@fvdm
fvdm / dup-backup.sh
Created January 19, 2017 20:19 — forked from Silvenga/dup-backup.sh
For daily systemwide encrypted backups of Ubuntu servers to remote host of Google Drive (free 15GB of storage).
#!/bin/bash
# Place in /usr/share/backup/
# and make executable
# chmod 0744 dup-backup.sh
# install:
# apt-get install duplicity python-gdata python-gobject-2 python-paramiko
## Remeber to change Google drive user name and Google drive folder
## And change Email
# Must run as root for system wide backups
@fvdm
fvdm / nvm_speedup.sh
Last active December 23, 2016 11:32
Add to bottom of .bashrc, .bash_profile or .profile - https://frankl.in/code/nvm-slowing-down-terminal
# Add latest node bin to $PATH
# Use with `nvm unalias default` to speed up shell init
# https://frankl.in/code/nvm-slowing-down-terminal
nodepath=$NVM_DIR/versions/node/`ls $NVM_DIR/versions/node/ | cat | tail -n 1`/bin
export PATH=$PATH:$nodepath

Keybase proof

I hereby claim:

  • I am fvdm on github.
  • I am fvdm (https://keybase.io/fvdm) on keybase.
  • I have a public key ASCe9Ow6JmCiKgXc1Q6QIyzEyD9wtLghNrP57_gYXs5BxAo

To claim this, I am signing this object:

@fvdm
fvdm / DownloadStationAPI.py
Created April 17, 2016 13:37 — forked from harperreed/DownloadStationAPI.py
example script to sync/download/etc put.io downloads to your synology download station
import time
import requests
import json
class DownloadStationAPI():
def __init__(self, host=None, username=None, password=None):
self.name = 'DownloadStation'
// Only copy new images to another folder:
require ('osx-photostream') ('~/Pictures/iCloud');
// Do more stuff with them:
var ps = require ('osx-photostream') ();
ps.on ('update', function (file) {
console.log ('New image added: ' + file.filename);
};)
#!/bin/sh
if [ $TERM = "screen" ]; then
sudo sh -c ' \
apt-get update \
&& apt-get $1 upgrade \
&& apt-get $1 dist-upgrade \
&& apt-get $1 autoremove \
&& apt-get clean'
else
screen -S update ~/bin/update $1
# swap when less than N % mem is available
vm.swappiness = 10
# cache inodes (50 = don't shrink inode cache)
vm.vfs_cache_pressure = 50
# % memory available for all processes -- some suggest 50
vm.overcommit_ratio = 100
# 0 = fuzzy available memory guessing : bad
#!/bin/sh
export arg=$@
find . -name '.git' -type d -exec bash -c 'path=${1%/.git}; echo $path; cd "$path" && git gc $arg' 0 {} \;
# Force download for certain URLs with ?force_download
set $forceDownload "";
set $filename "";
if ($request_filename ~ /([^/]+)$) {
set $filename $1;
}
if ($request_uri ~ [\?&]force_download(=(?<filename>[^&$]+)|&|$)) {
set $forceDownload "attachment; filename=\"$filename\"";
#!/usr/bin/env node
/*
USAGE: cat file.json | parsejson [OPTION] [PROPERTY]
Name: parsejson
Description: Parse JSON text to human-readable tree with syntax coloring.
Source: https://frankl.in/code/json-cli-parser-with-syntax-coloring
Author: Franklin (https://github.com/fvdm)
License: Unlicense / Public Domain