Skip to content

Instantly share code, notes, and snippets.

View dtinth's full-sized avatar
🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪

Thai Pangsakulyanont dtinth

🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪
  • @bemusic                 @creatorsgarten                 @eventpop                 @showdownspace                 @spacetme                @wonderfulsoftware                
  • Krungthepmahanakhonamonrattanakosinmahintharayutthayamahadilokphopnoppharatratchathaniburiromudomratchaniwetmahasathanamonphimanawatansathitsakkathattiyawitsanukamprasit (Bangkok), Thailand
  • YouTube @dtinth
View GitHub Profile
View adventofcode-2022-day-24-part-2-animated-visualization.rb
# https://www.youtube.com/watch?v=vz1oG-YlvAY
# https://www.reddit.com/r/adventofcode/comments/zu3pat/2022_day_24_part_2_terminal_visualization/?utm_source=share&utm_medium=web2x&context=3
require 'paint'
lines = $stdin.readlines.map(&:chomp)
directions = {
'^' => [0, -1],
'v' => [0, 1],
'<' => [-1, 0],
'>' => [1, 0]
@dtinth
dtinth / stagesetter.ts
Created November 4, 2022 11:06
stagesetter.ts
View stagesetter.ts
const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom')
export type Input<T> = T | Output<T>
export interface Output<T> {
resolveWithContext(ctx: Context): Promise<T>
}
class OutputImpl<T> implements Output<T> {
private promise?: Promise<T>
View jamulus-issue-2046-fuzz.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int iCurNumChannels;
int vecChannelOrder[100];
unsigned int vecChannels[100];
#define INVALID_CHANNEL_ID 101
void InitChannel(int iNewChanID, unsigned int InetAddr)
@dtinth
dtinth / jamulus-debian.sh
Last active August 11, 2021 13:33
Jamulus easy installation on debian 10
View jamulus-debian.sh
# wget -O- https://gist.githubusercontent.com/dtinth/b8d23de26a1820ec6f7a7238bc895f44/raw/jamulus-debian.sh | sudo bash
set -eo pipefail
JAMULUS_FILE=jamulus_headless_3.8.0_ubuntu_amd64.deb
JAMULUS_URL=https://github.com/jamulussoftware/jamulus/releases/download/r3_8_0/$JAMULUS_FILE
NUM_STEPS=5
echo "Step 1/$NUM_STEPS - Download Jamulus"
wget -O"$JAMULUS_FILE" "$JAMULUS_URL"
View bms_sound_process.rb
file_list = Dir['original/*.wav']
file_list.each_with_index do |original_wav, index|
basename = File.basename(original_wav)
target_wav = "processed/#{basename}"
gain = case basename
when /^piano/; 4
else; 0
end
puts "[#{index + 1}/#{file_list.length}] #{basename} (#{gain})"
system "sox", original_wav, target_wav, "gain", "#{gain}" or raise "Cannot convert"
@dtinth
dtinth / .gitignore
Last active September 26, 2019 17:09
Live coding 2019-09-25 — brute forcing AunJessada’s upcoming song title
@dtinth
dtinth / README.md
Created August 13, 2019 12:59
Transcribing Thai YouTube video using Google Cloud
View README.md

How to transcribe Thai speech in videos into text.

Requirements

@dtinth
dtinth / cut.js
Created June 28, 2019 07:54
Thai word cut in Chrome
View cut.js
// Note: Using non-standard V8 feature
// https://code.google.com/archive/p/v8-i18n/wikis/BreakIterator.wiki
//
// The standard is now Intl.Segmenter but no browser implements it yet.
//
function cut(text) {
const iterator = new Intl.v8BreakIterator(["th"]);
iterator.adoptText(text);
const result = [];
let pos = iterator.first();
View index.ts
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import 'firebase-functions'
import express from 'express'
import { middleware, Client } from '@line/bot-sdk'
admin.initializeApp()
export const bot = functions.https.onRequest((req, res) => {
const config = {
channelAccessToken: functions.config().line.channel.accesstoken,
channelSecret: functions.config().line.channel.secret