Skip to content

Instantly share code, notes, and snippets.

View vtno's full-sized avatar
👾
building

Tino Thamjarat vtno

👾
building
View GitHub Profile
@vtno
vtno / .kumose.yml
Last active February 20, 2024 08:12
app:
name: <app-name>
type: node
env:
clear:
NODE_ENV: production
secret:
API_KEY
cities = ['BANGKOK', 'ALGIERS', 'ISTANBUL', 'NASSAU', 'JEDDAH', 'WINNIPEG', 'GUATEMALA CITY', 'YASUJ', 'EDMONTON', 'FECAMP', 'ROME', 'PLOVDIV', 'OSAKA', 'UTRECHT', 'DAR ES SALAAM', 'KUALA LUMPUR',
'MAZAR E SHARIF', 'SHANGHAI', 'TOKYO', 'LUCKNOW', 'HYDERABAD']
current = cities.shift
until cities.empty?
cities.each_with_index do |city, index|
if city[0] == current[-1]
current = city
cities.delete_at(index)
end
@vtno
vtno / JUST_INSTALL_GPG.sh
Last active February 25, 2022 09:56
Install GnuPG 2.3.3 in one go. Check for compatible lib version on the official download page: https://gnupg.org/download/index.html
#!/usr/bin/env bash
set -e -x
sudo apt-get update
sudo apt-get -y install libgnutls28-dev bzip2 make gettext texinfo gnutls-bin build-essential g++
mkdir -p gnupg23
pushd gnupg23
@vtno
vtno / 90-thai.conf
Last active October 24, 2021 09:09
A configuration to set font for Thai language in PopOS/Ubuntu
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="lang" compare="contains">
<string>th</string>
</test>
<test qual="any" name="family">
<string>sans-serif</string>
</test>
@vtno
vtno / popcat.rb
Created August 14, 2021 20:33
POP DAT CAT
require 'watir'
b = Watir::Browser.new
b.goto 'https://popcat.click'
i = b.images.first
loop do
i.click
sleep 0.04 # 8000 click per 5 mins ~= 1 click per 0.04s
end
@vtno
vtno / finding-service-zone-distribution-gcp-gke.rb
Last active March 12, 2021 14:27
A script to count pod zone distribution on GCP. Use to find out how many pods are in which zones. Works with Ruby 3.0+
require 'csv'
running_instances = `gcloud compute instances list | ack <node-name> | ack RUNNING`
parsed_instance_list = CSV.parse(running_instances.squeeze(' ').gsub(' ', ','))
# instance name as key, region as value
instance_name_with_region = parsed_instance_list
.group_by do |a|
a[0]
end
.map do |k, v|
class QualityCalculator
def self.calculate_for_normal_award(award)
# normal award logic here
# which would update the quality of the award passed in
return award
end
def self.calculate_for_blue_first_award(award)
# blue first award logic here
# which would update the quality of the award passed in
// rt = refund_transaction
// st = source_transaction (refunded transaction)
// rd = refund_details
// Mapper
public RefundWithSourceTransaction map(int index, ResultSet r, StatementContext ctx) {
RefundDetail refundDetail = new RefundDetail(
UUID.fromString(r.getString("rd.id")),
UUID.fromString(r.getString("rd.transaction_id")),
UUID.fromString(r.getString("rd.source_transaction_id")),
-- rt = refund_transaction
-- st = source_transaction (refunded transaction)
-- rd = refund_details
SELECT *
FROM transactions AS st
INNER JOIN refund_details AS rd
ON st.transaction_id = rd.source_transaction_id
INNER JOIN transactions AS rt ON rt.transaction_id = rd.transaction_id
WHERE st.transaction_id = :transactionId
@vtno
vtno / setup-ubuntu.sh
Last active April 18, 2020 09:59
Setup a new Ubuntu machine for my personal use
set -e
cd
sudo apt update && sudo apt install -y build-essential zsh tmux libssl-dev libreadline-dev zlib1g-dev libpq-dev
# Setting up ZSH
chsh -s /usr/bin/zsh $USER
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Setup Z