Skip to content

Instantly share code, notes, and snippets.

@neverlock
neverlock / code.gs
Created April 14, 2023 06:13 — forked from neno-tech/code.gs
เรียนรู้เว็บแอปบันทึกข้อมูลลงชีตทีละส่วน
function doGet() {
return HtmlService.createTemplateFromFile('index').evaluate()
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
@neverlock
neverlock / multipart.lua
Created July 18, 2021 06:46 — forked from tonytonyjan/multipart.lua
wrk file upload example
function read_file(path)
local file, errorMessage = io.open(path, "rb")
if not file then
error("Could not read the file:" .. errorMessage .. "\n")
end
local content = file:read "*all"
file:close()
return content
end
/******************************\
!!! คำเตือน โปรดระวัง !!!
การใช้บอท มีความเสี่ยงที่จะถูกแบนได้
แนะนำให้สร้างบัญชีใหม่มาบอทโดยเฉพาะ
\******************************/
class TLMBot {
constructor(minWaitTime = 5000, maxWaitTime = 15000) {
this.minWaitTime = minWaitTime;
this.maxWaitTime = maxWaitTime;
@neverlock
neverlock / base-oauth2-google.go
Last active February 15, 2021 00:42
example oauth-google
package handlers
import (
"net/http"
)
func New() http.Handler {
mux := http.NewServeMux()
// Root
mux.Handle("/", http.FileServer(http.Dir("templates/")))
@neverlock
neverlock / google_oauth.go
Created April 18, 2020 16:26 — forked from evanj/google_oauth.go
Go Google Oauth2 example using the tokeninfo endpoint
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"golang.org/x/oauth2"
@neverlock
neverlock / HttpProxy.go
Created February 5, 2020 03:38 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@neverlock
neverlock / HttpProxy.go
Created February 5, 2020 03:38 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@neverlock
neverlock / authorize.lua
Created June 18, 2019 09:30 — forked from philwinder/authorize.lua
IVZ: Nginx config for using Lua as the authentication module. You must install nginx with lua support. See "openresty" for linux distros or the vagrant bootstrap shell script.
--[[
Provides custom authorization for nginx.
See the `nginx_authorize_by_lua.conf` for the Nginx config. This lua file is referenced in the config
See testWebserverAccess.sh for unit tests.
To Run nginx (make sure you have the lua, config and htpasswd file):
$ /usr/local/openresty/nginx/sbin/nginx -c /etc/nginx/conf/nginx_authorize_by_lua.conf
Logs are available at: /usr/local/openresty/nginx/logs/lua.log
To write to the log:
@neverlock
neverlock / compile-nfs-ganesha-ubuntu-16.04
Last active June 17, 2019 14:20 — forked from cy-lee/compile-nfs-ganesha-ubuntu-16.04
Compile nfs-ganesha under Ubuntu-16.04
# Refer: https://www.techsutram.com/2017/07/practical-way-to-build-nfs-ganesh-from.html
git clone https://github.com/nfs-ganesha/nfs-ganesha.git
cd nfs-ganesha
git submodule update --init --recursive
mkdir build
cd build
sudo apt-get install –y g++ libboost-dev cmake make git doxygen uuid-dev libcephfs-dev
sudo apt-get install –y build-essential libglu1-mesa-dev libc6-dev
sudo apt-get install –y libkrb5-dev libgss-dev liburcu-dev bison flex
@neverlock
neverlock / expvar_mux.go
Created June 6, 2019 09:27 — forked from flowerinthenight/expvar_mux.go
Serving expvar when using gorilla/mux.
package main
import (
"expvar"
"log"
"net/http"
"github.com/gorilla/mux"
)