Skip to content

Instantly share code, notes, and snippets.

View rocklau's full-sized avatar
🐢
happy

Rocky LIU rocklau

🐢
happy
View GitHub Profile
@rocklau
rocklau / linux-setup.sh
Created May 26, 2024 02:00 — forked from dhh/linux-setup.sh
linux-setup.sh
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@rocklau
rocklau / readfiles.ts
Last active September 28, 2021 12:48
deno read line by line
import { readLines } from "https://deno.land/std/io/mod.ts";
import * as path from "https://deno.land/std/path/mod.ts";
async function readAll() {
const filename = path.join(Deno.cwd(), "./data.txt");
let fileReader = await Deno.open(filename);
for await (let line of readLines(fileReader)) {
console.log(line);
@rocklau
rocklau / script-template.sh
Created December 21, 2020 16:03 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@rocklau
rocklau / test_curl_httpbin.lua
Created March 22, 2019 00:55
httpbin test for freeswitch curl
json = freeswitch.JSON()
curl = freeswitch.cURL()
GET ='get'
POST ='post'
PUT = 'put'
DELETE ='delete'
CONTENT_TYPE ='application/json'
proto = "http://"
domain = "httpbin.org"
@rocklau
rocklau / dapper.fs
Created January 23, 2018 06:18
Dapper for System.Data.SqlClient
let dapperExecute (query:string) (connection:SqlConnection):int=
connection.Execute(query)
let dapperParametrizedExecute (query:string) (param:obj) (connection:SqlConnection):int =
connection.Execute(query,param)
let dapperQuery<'Result> (query:string) (connection:SqlConnection) =
@rocklau
rocklau / install-you-get-on-android.sh.md
Last active April 24, 2018 08:44
run you-get on andorid

1.install termux and termux-api in Play Store

2.Tapping this link https://sdrausty.github.io/TermuxArch/setupTermuxArch.sh will transfer setupTermuxArch.sh to your device.

3.Simply run bash ~/storage/downloads/setupTermuxArch.sh to install Arch Linux.

4.Run command startarch in termux

startarch
@rocklau
rocklau / dapperformysql.fs
Created December 7, 2017 11:37
Dapper for MySql client
open MySql.Data.MySqlClient
open Dapper
open System.Dynamic
open System.Collections.Generic
let dapperExecute (query:string) (connection:MySqlConnection):int=
connection.Execute(query)
let dapperParametrizedExecute (query:string) (param:obj) (connection:MySqlConnection):int =
@rocklau
rocklau / mysqldaaper.fs
Created December 7, 2017 11:36
Dapper for mysql
open MySql.Data.MySqlClient
open Dapper
open System.Dynamic
open System.Collections.Generic
let dapperExecute (query:string) (connection:MySqlConnection):int=
connection.Execute(query)
let dapperParametrizedExecute (query:string) (param:obj) (connection:MySqlConnection):int =
@rocklau
rocklau / syntax.fsi
Last active December 1, 2017 08:57
fsharp syntax : recursion
// keyword rec
let minlen prevminlen =
let compareprev str =
let strlen = str.ToString().Length
if prevminlen = 0 then
strlen
else
min prevminlen strlen
compareprev
@rocklau
rocklau / ffmpeg m3u8.bat
Last active January 16, 2018 03:54
ffmpeg command
ffmpeg.exe -protocol_whitelist "file,http,https,tcp,tls" -i http://demo.io/demo.mp4 demo.mp4