Skip to content

Instantly share code, notes, and snippets.

View todgru's full-sized avatar

todgru

  • Portland, OR
View GitHub Profile
@todgru
todgru / knit.rb
Created May 5, 2017 19:31 — forked from nrser/knit.rb
knit.rb - recursively `yarn link` together all `file:<path>` deps in package.json manifests.
#!/usr/bin/env ruby
# recursively `yarn link` together all `file:<path>` deps in package.json
# manifests.
#
# USAGE
#
# knit.rb PACKAGE_DIRECTORY
#
# AUTHOR nrser
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
@todgru
todgru / index.js
Created November 29, 2017 03:39 — forked from joerx/index.js
Mocking S3 in Node.js using Sinon
var Aws = require('aws-sdk');
var sinon = require('sinon');
// Only works for 'createBucket', 'update' and a few others since most API methods are generated dynamically
// upon instantiation. Very counterintuitive, thanks Amazon!
var createBucket = sinon.stub(Aws.S3.prototype, 'createBucket');
createBucket.yields(null, 'Me create bucket');
// For other methods, we can 'assign' the stubs to the proto, already defined function won't be overridden
var listBuckets = Aws.S3.prototype.listBuckets = sinon.stub();
@todgru
todgru / darkify_slack.sh
Created January 17, 2019 19:14 — forked from ryanpcmcquen/darkify_slack.sh
Darkify your Slack.
#!/bin/sh
# Darkify Slack on Mac OS:
# curl https://gist.githubusercontent.com/ryanpcmcquen/8a7ddc72460eca0dc1f2dc389674dde1/raw/darkify_slack.sh | sh
SLACK_INTEROP_JS="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"
# Thanks to: https://gist.github.com/DrewML/0acd2e389492e7d9d6be63386d75dd99#gistcomment-2358430
if [ -z "`grep tt__customCss ${SLACK_INTEROP_JS}`" ]; then
# Backup original CSS for reverts:
@todgru
todgru / rpi3-bt-keyboard.txt
Created June 30, 2019 16:34 — forked from tekemperor/rpi3-bt-keyboard.txt
Connect Apple Wireless Keyboard to Raspberry Pi 3 in Raspbian
sudo service bluetooth status # Verify bluetooth is active.
sudo bluetoothctl # Lauch bluetooth subshell.
agent on # [No idea what this does.]
default-agent # [No idea what this does.]
scan on # Displays a list of available devices.
pair XX:XX:XX:XX:XX:XX # This prepares a potential connection, the X's represent your device ID
# A "PIN code" will be displayed, type it on the keyboard and press "enter".
trust XX:XX:XX:XX:XX:XX # Adds device to trusted devices, this survives reboot.
connect XX:XX:XX:XX:XX:XX # Connect to the device now.
exit # Return to previous shell.
@todgru
todgru / git-deployment.md
Last active April 28, 2020 23:53 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks. Example to copy dist distribution directory.

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@todgru
todgru / post-receive
Created April 28, 2020 21:59 — forked from tlrobinson/post-receive
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

@todgru
todgru / README.md
Created December 19, 2020 00:14 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.