Skip to content

Instantly share code, notes, and snippets.

View ytensor42's full-sized avatar
🏠
Working from home

Han Cho ytensor42

🏠
Working from home
  • Ansolute
  • SF Bayarea
View GitHub Profile
@ytensor42
ytensor42 / qr-code-read
Last active November 4, 2018 07:50
QR Read
# https://www.npmjs.com/package/qrcode-reader
var fs = require("fs");
var QrCode = require('qrcode-reader');
var Jimp = require("jimp");
var buffer = fs.readFileSync(__dirname + '/qr1.png');
Jimp.read(buffer, function(err, image) {
if (err) {
console.error(err);
@ytensor42
ytensor42 / mfa-speakeasy
Last active November 4, 2018 07:52
MFA using speakeasy
# https://www.npmjs.com/package/speakeasy
const speakeasy = require('speakeasy');
// Generate Key
var secret = speakeasy.generateSecret();
// secret sample
{ ascii: '6v[qFO^%vfqL%C,Kdv*oCqTGZ0z^p]vU',
hex: '36765b71464f5e257666714c25432c4b64762a6f437154475a307a5e705d7655',
@ytensor42
ytensor42 / youtube_2_mp3
Last active March 18, 2025 08:19
Youtube to mp3
#!<your python3 path>
#
# ymp3.py
# ; Download youtube contents and convert into mp3
# ; Prerequisite: pytube, ffmpeg
#
#
import subprocess
import argparse
@ytensor42
ytensor42 / gpg_cheat_sheet
Last active November 14, 2018 03:04
gpg cheat sheet
# Quick'n easy gpg cheatsheet
# http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/
to create a key:
gpg --gen-key
generally you can select the defaults.
to export a public key into file public.key:
gpg --export -a "User Name" > public.key
This will create a file called public.key with the ascii representation of the public key for User Name. This is a variation on:
# Source: https://gist.github.com/627fcfbfbc17a683a70210947e02eaa3
##########
# Kaniko #
##########
open https://github.com/vfarcic/kaniko-demo
# Fork it

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.
#!/usr/bin/python
from apiclient.discovery import build
import httplib2
from oauth2client.service_account import ServiceAccountCredentials
from oauth2client.client import GoogleCredentials
import logging
import json
import sys