Skip to content

Instantly share code, notes, and snippets.

View nii236's full-sized avatar

John Nguyen nii236

View GitHub Profile
@zaydek-old
zaydek-old / howto
Last active July 21, 2019 07:04
Proof-of-concept for SQL-driven logging. You can like this tweet for updates: https://twitter.com/username_ZAYDEK/status/1114827120524419073
bash$ pg_ctl -D /usr/local/var/postgres start ## init postgres
bash$ psql -d postgres ## connect to postgres
psql# create database logger; -- create a database named "logger"
psql# begin; -- start a transaction
psql# \i log.sql -- load database
psql# commit; -- commit the transaction
bash$ go run log.go ## run driver program
@adamcharnock
adamcharnock / howto.md
Last active June 18, 2020 01:48
Kubernetes install on Ubuntu 17.10 via kubeadm

Kubernetes install on Ubuntu 17.10 via kubeadm

Initial setup

apt-get update
apt-get upgrade
apt-get install curl

# Check VXLAN exists
@lsowen
lsowen / check_sig.go
Last active November 23, 2023 23:31
GPG Signature Verification in go (with golang.org/x/crypto/openpgp)
package main
import (
"fmt"
"golang.org/x/crypto/openpgp"
"os"
)
func main() {
keyRingReader, err := os.Open("signer-pubkey.asc.txt")
@ampedandwired
ampedandwired / README.md
Last active October 6, 2022 06:40
webpack-dev-server with html-webpack-plugin
$ npm install
$ ./node_modules/.bin/webpack-dev-server
$ open http://localhost:8080/webpack-dev-server/

Notes:

  • Note the trailing slash on the URL is significant. Without it webpack-dev-server shows a file listing page.
  • You need 1.0.11 or later of webpack-dev-middleware for this URL to work. With earlier versions you need to specify the full URL like this: http://localhost:8080/webpack-dev-server/index.html.
  • To get a non-autoreloading version of the page use http://localhost:8080/index.html.
@jakecoffman
jakecoffman / resizer.go
Last active August 7, 2017 08:02
Resize all images in a directory (Golang)
package main
import (
"fmt"
"image/jpeg"
"io/ioutil"
"log"
"os"
"strings"
@AnthonySteele
AnthonySteele / NancyModuleExtensions
Last active April 11, 2019 09:19
Example code for my blog post on function shims for NancyFx request handlers
/*
* Example code for my blog post on function shims for NancyFx request handlers
* Blog post is here: http://anthonysteele.co.uk/more-patterns-for-web-services-in-nancyfx
*/
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Nancy;
@radiatoryang
radiatoryang / ForceDirectedGraph.cs
Created May 30, 2013 23:20
method for doing force directed graph stuff with NGenerics + Unity... to make it 3D, just change Vector2's to Vector3's
IEnumerator ForceDirectGraph<T>( Graph<T> graph, Dictionary<T, Vector3> graphPositions ) {
// settings
float attractToCenter = 15f;
float repulsion = 10f;
float spacing = 0.1f;
float stiffness = 100f;
float damping = 0.9f;
// initialize velocities and positions
Dictionary<Vertex<T>, Vector2> velocity = new Dictionary<Vertex<T>, Vector2>();
@zenorocha
zenorocha / README.md
Last active April 6, 2024 16:59
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@sartak
sartak / a.md
Last active March 22, 2024 22:16
Anki 2 annotated schema
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...