Skip to content

Instantly share code, notes, and snippets.

View nbriz's full-sized avatar

Nick Briz nbriz

View GitHub Profile
@brizandrew
brizandrew / index.js
Created November 14, 2018 00:21
Download a Google Drive file of a given type with a JSON Web Token via Drive Api v3
/**
* Simple Node Script for Downloading Google Drive files (Drive API v3).
* Use these instructions to get a GAPI_CLIENT_EMAIL and GAPI_PRIVATE_KEY: https://github.com/The-Politico/api-to-sheets#making-a-google-service-account
* See all available types by document here: https://developers.google.com/drive/api/v3/manage-downloads
*/
const { JWT } = require('google-auth-library');
const { google } = require('googleapis');
const client = new JWT({
@brizandrew
brizandrew / template.js
Created July 11, 2017 21:59
Renders a template string based on positional and keyword arguments.
/**
* Renders a template string based on positional and keyword arguments.
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
* @example
* // returns 'YAY!'
* let t1Closure = template`${0}${1}${0}!`;
* t1Closure('Y', 'A');
* @example
* // returns 'Hello World!'
* let t2Closure = template`${0} ${'foo'}!`;
@brannondorsey
brannondorsey / one_liners.md
Last active July 8, 2022 05:07
One Liners

Count the number of unique characters in a file

# https://unix.stackexchange.com/questions/5010/how-can-i-count-the-number-of-different-characters-in-a-file
# works for linux. There is a variation for MacOS in the link ^
sed 's/\(.\)/\1\n/g' text.txt | sort | uniq -c # sort -nr # uncomment this to sort the list by frequency

Replace a string in all instances of files in a directory

@kennwhite
kennwhite / vpn_psk_bingo.md
Last active February 24, 2024 12:19
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

An Open Letter to Young Software Authors

By Brannon Dorsey

I harbor a great fear that we have become overwhelmingly misguided in our mass popularization of networked computing and large-scale reliance/transcendence of proprietary software into our personal and social lives. We have strayed far from some of the revolutionary ideas from which the internet and personal computing were birthed and if our present trajectory is left unaltered the technological future we will find ourselves in is not overwhelmingly bright. It is for this reason that I feel compelled to speak up, asking much from young software authors like myself that are finding their skills so ever more in-demand and who I know care so deeply for the future of a media in which they have found such connection, challenge, and personal achievement.

For them (and others), this document is intended to present a perspective of technological positivism at its core layered deeply under a mantle of skepticism regarding aggr

@nbriz
nbriz / leave_facebook.js
Last active October 16, 2018 10:36 — forked from subimage/jquery-2.1.1.min.js
all-in-one script ( with parameters ) >> big thnx to @subimage && xtra updates by Luigi DiGangi
// forked from subimage's modifications of my much messier prior scripts
// ( https://gist.github.com/subimage/d952e49c9184d6a7a74f )
// after entering jquery into ur console, enter the code below in ur console
// then load a few months of activity && enter leaveFacebook(); into ur console
// u can specify parameters like so: leaveFacebook('Unlike'); if u only want to unlike
// or leaveFacebook('Unfriend'); if u only want to unfriend
// etc...
// visit nickbriz.com/facebook for vidz && details
@subimage
subimage / jquery-2.1.1.min.js
Last active August 20, 2018 19:44
Refined version of @nbriz's "Leave Facebook" collection
/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,
@yyolk
yyolk / cache_mine.sh
Last active December 25, 2015 00:49
grab all JPEGs, PNGs, and GIFs from Chrome's cache (useful for when someone deletes a post)
#!/bin/sh
CHROME_CACHE=$HOME/Library/Caches/Google/Chrome/Default/Cache
TMP_DIR=$HOME/Downloads/tmp
mkdir -p $TMP_DIR
for i in $(file $CHROME_CACHE/* | egrep -i 'jp|gif|png' |awk '{print $1}' | sed 's/://g'); do cp -v $i $TMP_DIR/`basename $i`.$(file $i | awk '{print tolower($2)}') ; done