Skip to content

Instantly share code, notes, and snippets.

View haint's full-sized avatar

Ethan Nguyen haint

  • FPT Software
  • Hanoi Vietnam
View GitHub Profile
#!/bin/bash
PID_FILE="./rethinkdb.pid"
LOG_FILE="./log.txt"
COMMAND="rethinkdb --port-offset 1 --bind all --directory ./data > $LOG_FILE &"
start_rethinkdb() {
if [ -f $PID_FILE ]; then
echo "RethinkDB is already running. PID: $(cat $PID_FILE)"
else
@haint
haint / vagrant-vmware-fusion-13-apple-m1-pro.md
Created March 9, 2023 16:13 — forked from sbailliez/vagrant-vmware-fusion-13-apple-m1-pro.md
Vagrant and VMWare Fusion 13 on Apple M1 Pro

Vagrant and VMWare Fusion 13 Player on Apple M1 Pro

This document summarizes notes taken to make VMWare Fusion 13 Player work on Apple M1 Pro. It builds upon a previous document based on VMWare Tech Preview 21H1

VMWare Fusion 13 was released on November 17, 2022

Created on: November 20, 2022

Updated on: November 20, 2022

@haint
haint / curl.md
Created August 22, 2022 16:00 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@haint
haint / .gitlab-ci.yml
Created April 5, 2022 08:28 — forked from daicham/.gitlab-ci.yml
A sample of .gitlab-ci.yml for a gradle project
image: java:8-jdk
stages:
- build
- test
- deploy
before_script:
# - echo `pwd` # debug
# - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
@haint
haint / .vimrc
Created April 4, 2022 09:18 — forked from ericktedeschi/.vimrc
Vim - My .vimrc
" syntax highlighting
set bg=light
syntax on
set ruler
set number
set smarttab
set fileformats=unix,dos,mac " support all three, in this order
set formatoptions=tcqor " t=text, c=comments, q=format with "gq", o,r=autoinsert comment leader
set cindent " indent on cinwords
@haint
haint / CryptoKitties.sol
Created January 6, 2022 11:05 — forked from yogin/CryptoKitties.sol
CryptoKitties
// Copied from: https://ethfiddle.com/09YbyJRfiI
// CryptoKitties Source code
// Copied from: https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
@haint
haint / minikube.md
Created November 5, 2021 10:56 — forked from rahulkumar-aws/minikube.md
Install/Uninstall Minikube from Mac
minikube stop; minikube delete
docker stop $(docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes
@haint
haint / uint8_to_hex.cpp
Created May 17, 2021 16:55 — forked from miguelmota/uint8_to_hex.cpp
C++ uint8_t to hex string
#include <sstream>
#include <iostream>
#include <iomanip>
std::string uint8_to_hex_string(const uint8_t *v, const size_t s) {
std::stringstream ss;
ss << std::hex << std::setfill('0');
for (int i = 0; i < s; i++) {
@haint
haint / gist:05c227b8519b206de27a6db79255436c
Created December 14, 2019 15:05 — forked from svrc-personal/gist:5a8accc57219b9548fe1
JDK 8 seems to use /dev/urandom and /dev/random more sensibly
Summary of Behaviour:
A. OpenJDK 7 b65.
1. Default in java.security is securerandom.source=/dev/urandom
2. If securerandom.source=/dev/urandom, NativePRNG is used, SecureRandom.nextBytes() is non-blocking via /dev/urandom ; SecureRandom.generateSeed(x) is blocking via /dev/random
3. if securerandom.source=/dev/random, then SHA1PRNG is used. Initial seed is blocking via /dev/random. No other accesses.
4. If securerandom.source=/dev/./urandom then SHA1PRNG is used. Initial seed is non-blocking via /dev/./urandom. No other accesses.
B. Oracle JDK 8 b25.
@haint
haint / ParseRSAKeys.java
Created November 2, 2019 15:16 — forked from destan/ParseRSAKeys.java
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;