Skip to content

Instantly share code, notes, and snippets.

View v9n's full-sized avatar
🛫
forward email at mailwip.com

Vinh Quốc Nguyễn v9n

🛫
forward email at mailwip.com
View GitHub Profile
@v9n
v9n / AuthyToOtherAuthenticator.md
Created March 13, 2020 21:07 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@v9n
v9n / README.txt
Last active December 19, 2019 21:02 — forked from ncw/README.txt
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh test@test.com
Run the server in one terminal
go run server.go
@v9n
v9n / tls-client.go
Created December 19, 2019 21:01 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@v9n
v9n / gist:9aa228db5a809ba7273230dae7ed6265
Created February 28, 2019 09:26 — forked from telent/gist:9742059
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@v9n
v9n / list-deps.cr
Created December 22, 2018 09:10 — forked from bcardiff/list-deps.cr
List binary dependencies to build a minimal docker image from scratch
unless ARGV.size > 0
puts " Missing executable file argument"
puts " Usage (in a Dockerfile)"
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable"
exit 1
end
executable = File.expand_path(ARGV[0])
unless File.exists?(executable)
@v9n
v9n / zero_xml.cr
Last active September 4, 2018 09:59
simple_xml.cr
# A toy XML parser to demo Crystal without ever reading XML RFC :-(
# So this will absolutely contain bugs
# This implementation use a state machine and may perform badly :)
# Maybe a stack based will be faster
module ZeroXML
VERSION = "0.1.0"
enum State
OpenTag
NameTag
@v9n
v9n / why-or-why-not-dart.md
Created March 27, 2018 06:26
Why or why not Dart?

Why or why not Dart?

This is my analysis of the Dart language. Overall, some parts I like, some parts I don't like and my overall view of it all.

My background

Depending on what my employers have required on the backend, I've used C#, node.js, PHP, Python & dashes of Ruby. I personally enjoy Javascript, and I'm especially a fan of node.js. I also really like CoffeeScript, and now that it has source maps, it could very well become something I use daily.

Below are my thoughts on Dart:

@v9n
v9n / promise_monad.md
Created March 5, 2018 20:39 — forked from VictorTaelin/promise_monad.md
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@v9n
v9n / web-servers.md
Created November 1, 2017 06:30 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@v9n
v9n / TestnetEthereumNetwork.md
Created October 25, 2017 07:04
Setup testnet Ethereum network with Docker

Setup testnet Ethereum network with Docker

Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference.

This is step-by-step guide, how to setup testnet Ethereum network.

We'll setup ethereum testnet node in the docker container and write ruby json-rpc client. The difference between ethereum(Frontier) and testnet ethereum(Ropsten) networks is that the testnet used for development. The genesis block on the testnet was set with a very low difficulty so anyone can do minning. The coins mained in the testnet have no values. You can request some coins on the facuet or trying to mine it.