Skip to content

Instantly share code, notes, and snippets.

View gokusenz's full-sized avatar
🎯
Focusing

Nattawut Ruangvivattanaroj gokusenz

🎯
Focusing
View GitHub Profile
@gokusenz
gokusenz / th-address.json
Created November 20, 2023 04:30 — forked from mennwebs/th-address.json
Thai Address from Postal Code - JSON
This file has been truncated, but you can view the full file.
[
{
"zipCode": "10100",
"subDistrictList": [
{
"subDistrictId": "100801",
"districtId": "1008",
"provinceId": "10",
"subDistrictName": "ป้อมปราบ"
const { ethers } = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://bsc-dataseed.binance.org/');
const BEP20 = {
BUSD: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
DOP: '0x844fa82f1e54824655470970f7004dd90546bb28',
};
const Contract = {
router: new ethers.Contract(
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
def lineNotify(message):
payload = {'message':message}
return _lineNotify(payload)
def notifyFile(filename):
file = {'imageFile':open(filename,'rb')}
payload = {'message': 'test'}
@gokusenz
gokusenz / redirect-ingress.yml
Created August 7, 2018 16:57 — forked from sandcastle/redirect-ingress.yml
An example of a ingress redirect using kubernetes and nginx `configuration-snippet`
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: redirect-ingress
annotations:
ingress.kubernetes.io/configuration-snippet: |
if ($host ~ ^(.+)\.somedomain\.io$) {
return 301 https://$1.domain.io$request_uri;
}
spec:
@gokusenz
gokusenz / emoji.go
Created November 1, 2017 09:12 — forked from YamiOdymel/emoji.go
Print the emoji with Golang. https://play.golang.org/p/yPgKw3Z9HW
// (c) 2017 Yami Odymel
// This code is licensed under MIT license.
package main
import (
"fmt"
"html"
"strconv"
)
@gokusenz
gokusenz / easyget.go
Created August 27, 2017 06:11 — forked from montanaflynn/easyget.go
GET JSON array in Golang
package easyget
import (
"io"
"io/ioutil"
"net/http"
)
// Define Request struct
type Request struct {
@gokusenz
gokusenz / GoMgoSample-1.go
Created June 1, 2017 06:30 — forked from ardan-bkennedy/GoMgoSample-1.go
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
@gokusenz
gokusenz / EncryptAESWithPHP
Created April 20, 2016 11:23 — forked from krzyzanowskim/EncryptAESWithPHP
How to encrypt data with padding usign AES cipher, complatible with CryptoSwift defaults.
// Marcin Krzyżanwski
// Code for https://github.com/krzyzanowskim/CryptoSwift/issues/20
// PHP
function encrypt($plaintext, $key, $iv) {
$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_CBC, $iv);
return base64_encode($ciphertext);
}
function decrypt($ciphertext_base64, $key, $iv) {