Skip to content

Instantly share code, notes, and snippets.

View vtno's full-sized avatar
👾
building

Tino Thamjarat vtno

👾
building
View GitHub Profile
@reytech-dev
reytech-dev / Fix.md
Last active March 20, 2024 10:19
ZONE_CONFLICT: 'docker0' already bound to a zone
  1. Check if docker zone exists in firewall-cmd
$ firewall-cmd --get-active-zones
  1. If "docker" zone is available, change interface to docker0 (not persisted)
$ sudo firewall-cmd --zone=docker --change-interface=docker0
  1. If "docker" zone is available, change interface to docker0 (persisted, thanks rbjorklin)
@jordan-wright
jordan-wright / main.go
Created August 11, 2020 02:56
Converting an ssh.PublicKey to an *rsa.PublicKey in Go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"log"
@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
@ubergesundheit
ubergesundheit / readme.md
Last active February 5, 2024 10:46
systemd traefik.service

systemd Service Unit for Traefik

Adapted from caddy systemd Service Unit

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.

Instructions

We will assume the following:

@markhorrocks
markhorrocks / test_google_sheets_apiV4.rb
Last active February 19, 2024 21:56
Editing Google Sheets with the Google::Apis::SheetsV4 Ruby Client
#! /usr/bin/ruby
require 'google/apis/sheets_v4'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
APPLICATION_NAME = 'Google Sheets API Test'
@lauraturk
lauraturk / circleci-heroku-continuous-deployment2.0.md
Last active November 23, 2021 15:28
instructions for deploying from circleci2.0 to heroku
@silkyland
silkyland / strToThaiSlug.js
Last active January 20, 2024 19:15
Convert string to slug in Thai language for SEO Friendly in JavaScript
/**
* Translates a string to a Thai slug format.
* @param {string} inputString - The string to translate.
* @returns {string} The translated string.
*/
function toThaiSlug(inputString) {
// Replace spaces with hyphens
let slug = inputString.replace(/\s+/g, '-');
// Translate some characters to Thai
@kendru
kendru / golang-to-node-authenticated-encryption.js
Last active October 24, 2023 13:15
Decrypting AES-256-GCM encoded in Go from Node
// Usage: go run main.go | node decode.js
/*
// main.go:
package main
import (
"crypto/aes"
"crypto/cipher"
@kyptin
kyptin / steps.md
Last active October 16, 2023 06:22
Accessing a rails console in Google App Engine (flexible)

If you're running a Rails app in Google App Engine's flexible environment, it takes a bit of setup to get to a rails console attached to your deployed environment. I wanted to document the steps for my own reference and also as an aid to others.

  1. Open the Google App Engine -> instances section of the Google Cloud Platform (GCP) console.

  2. Select the "SSH" drop-down for a running instance. (Which instance? Both of my instances are in the same cluster, and both are running Rails, so it didn't matter for me. YMMV.) You have a choice about how to connect via ssh.

    1. Choose "Open in browser window" to open a web-based SSH session, which is convenient but potentially awkward.

    2. Choose "View gcloud command" to view and copy a gcloud command that you can use from a terminal, which lets you use your favorite terminal app but may require the extra steps of installing the gcloud command and authenticating the gcloud command with GCP.

@javan
javan / direct-uploads.md
Last active January 29, 2023 10:58
Active Storage direct uploads

direct-uploads

rails/activestorage#81

// direct_uploads.js

addEventListener("direct-upload:initialize", event => {
  const { target, detail } = event
  const { id, file } = detail