Skip to content

Instantly share code, notes, and snippets.

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

Do Minh Hai dominhhai

🏠
Working from home
View GitHub Profile
@dominhhai
dominhhai / distributed-map.ts
Created January 12, 2024 08:36
CDK Distributed Map with S3
import {
IChainable,
JsonPath,
ProcessorConfig,
ProcessorMode,
Map as SfnMap,
} from 'aws-cdk-lib/aws-stepfunctions'
export type DistributedMapS3Parameter =
| {
@dominhhai
dominhhai / 1_ecs_note.md
Created March 26, 2023 10:31 — forked from ejlp12/1_ecs_note.md
ECS Best Practices Notes
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@dominhhai
dominhhai / s3.sh
Created June 30, 2020 01:43 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@dominhhai
dominhhai / certbot-systemd-nginx.md
Created January 11, 2020 09:22 — forked from mpolinowski/certbot-systemd-nginx.md
NGINX Certbot certificate renewal with SystemD (Let's Encrypt)

Create a service unit file

$ nano /etc/systemd/system/certbot-renewal.service
[Unit]
@dominhhai
dominhhai / gcolab-drive.py
Created September 27, 2018 01:44
Google Colab Code
# Connect with Google Drive
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import drive
drive.mount('/content/drive')
@dominhhai
dominhhai / octave.md
Created June 24, 2017 11:37 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &&
@dominhhai
dominhhai / letsencrypt.md
Last active February 14, 2017 02:07
Nginx vs Let's Encrypt

Check Python v2.7.x

$ python --version

Check open 443 port

$ sudo cat /etc/sysconfig/iptables

Get certbot from Github

@dominhhai
dominhhai / tor-install.txt
Last active September 7, 2021 09:04
MacOSでTorの簡単なインストール方法 ref: https://dominhhai.github.io/vi/2017/01/tor-on-mac/
# Brewの場合
$ brew install tor
# Macportsの場合
$ sudo port install tor
@dominhhai
dominhhai / 1-react-native-simulator-and-device.md
Created July 25, 2016 02:01 — forked from almost/1-react-native-simulator-and-device.md
Test React Native on the simulator and on a device without editing the code each time!

In the default React Native app scaffolding you have to edit AppDelegate.m to change where it loads the code if you want to test on your device. I use the following snippet to detect if it's being compiled for Debug or Production and for the Simulator or a device. For Production it uses a copy of the code included in the bundle, for Debug on the simualtor it loads from a server on localhost and for Debug on a device it loads from a server on a given IP address.

NOTE: You need to edit YOUR-IP-HERE and change it to the IP to load the code from when in Debug mode on a device. You could use a service like ngrok to make this work from anywhere.

  NSURL *jsCodeLocation;

  // Loading JavaScript code
  #if DEBUG
    // For Debug build load from development server. Start the server from the repository root: