Skip to content

Instantly share code, notes, and snippets.

@nooptr
nooptr / piping.sh
Created July 8, 2023 02:23
piping server
## Sender
tar zcf - 16888_part2.sql | curl -T - https://ppng.io/nooptr
## Receiver
curl https://ppng.io/nooptr | tar zxpf - -C .
// 1. Import everything
import { Wallet, BigNumber, ethers, providers } from 'ethers'
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle')
/*
Mainnet
const provider = new providers.JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh')
const wsProvider = new providers.WebSocketProvider('wss://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh')
*/
@nooptr
nooptr / nodejs aws credentials.txt
Last active April 10, 2020 06:12
nodejs aws credentials
Thứ thự load credentials sẽ như sau:
1. Load từ role IAM của Amazon EC2
2. Load từ file (~/.aws/credentials)
3. Load từ biến môi trường
4. Load từ file json ở trên disk
5. Thông tin credential được định nghĩa trực tiếp trong file JS
====
Có 1 số cách có thể load được cấu hình IAM của aws vào trong nodejs
@nooptr
nooptr / nginx_hls
Last active February 15, 2020 13:41
Nginx hls ubuntu 16.04
# Install nginx
git clone https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.git
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
wget http://nginx.org/download/nginx-1.17.8.tar.gz
tar -xf nginx-1.10.1.tar.gz
cd nginx-1.10.1
./configure --add-module=../nginx-rtmp-module --with-http_ssl_module --with-http_stub_status_module --prefix=/etc/nginx
make -j 1
@nooptr
nooptr / keybase.md
Last active November 17, 2019 00:00

Keybase proof

I hereby claim:

  • I am nooptr on github.
  • I am thangnv (https://keybase.io/thangnv) on keybase.
  • I have a public key ASBNaxD5MW9_jkVOT9-TiPJ29QmNoTJPEgJ0r0tB-9e3ugo

To claim this, I am signing this object:

curl 'https://shopee.vn/api/v2/search_items/?by=pop&limit=50&match_id=78&newest=0&order=desc&page_type=search' -H 'referer: https://shopee.vn' -H 'if-none-match-: 55b03-17c6363e0b4e25bdbc200053b1096e1a'
#!/bin/bash
wget -i files.txt
# ex: rename file test.jpg?w=12&h=15 to test.jpg
for FILE in *; do mv $FILE ${FILE%\?*}; done
# tham khao:
# https://unix.stackexchange.com/questions/33279/how-can-i-rename-multiple-files-by-removing-a-character-or-string
#!/bin/bash
# ex: rename file test.jpg?w=12&h=15 to test.jpg
for FILE in *; do mv $FILE ${FILE%\?*}; done
# tham khao:
# https://unix.stackexchange.com/questions/33279/how-can-i-rename-multiple-files-by-removing-a-character-or-string
# ${i%-*} matches the begining of the filename up to the last occurrence of the dash -
# ${file##*-} matches the rest of the filename after the last occurrence of the dash -
1. Install
brew install youtube-dl
brew install libav

2. Usage
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=jP7BDJwSobY
#!/usr/bin/env bash
# Usage:
# ./solc [options] inputfile > outfile
# Notes:
# - file i/o is limited to the current directory
# - this works with the pyethereum solc_wrapper
docker run -i --rm --user $(id -u):$(id -g) -v $(pwd):/tmp --workdir /tmp ethereum/solc:0.4.24 $@