Skip to content

Instantly share code, notes, and snippets.

View narze's full-sized avatar
🕺
You know the rules, and so do I

Manassarn "Noom" Manoonchai narze

🕺
You know the rules, and so do I
View GitHub Profile
@narze
narze / common_words.txt
Created August 17, 2020 16:31
Most common English words, combined from 4 sources (except 1 character words & proper nouns)
// Source : https://github.com/narze/sandbox/blob/master/ruby/english-common-words.rb
the
of
to
and
in
is
it
that
@narze
narze / .phoenix.js
Created June 24, 2020 16:45
Trolling Window Manager (Proof of concept) with Phoenix.js
Event.on("mouseDidMove", (point) => {
// Phoenix.log(point.x, point.y)
const space = Space.active()
const windows = space.windows({ visible: true })
// TODO: Find nearest window which does not enclose the point
const distances = windows.map((w) => {
const f = w.frame()
// Phoenix.log(w.app().name(), f.x, f.y, f.width, f.height)
@narze
narze / twm.md
Last active March 25, 2021 02:03
Trolling Window Manager
@narze
narze / surfingkeys.js
Last active November 20, 2022 11:07
surfingkeys.js
// 1.0 Compatability
const {
aceVimMap,
mapkey,
imap,
imapkey,
getClickableElements,
vmapkey,
map,
unmap,
@narze
narze / live-coding-notes.md
Last active March 21, 2020 12:51
Live Coding Notes
@narze
narze / pedal.ino
Created January 22, 2020 10:51
Pedal : Arduino foot app switcher
#include <Keyboard.h>
bool pressed = false;
bool currentState;
bool lastState = false;
// the following variables are unsigned longs because the time, measured in
// milliseconds, will quickly become a bigger number than can be stored in an int.
unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
unsigned long debounceDelay = 10; // the debounce time; increase if the output flickers
@narze
narze / remove_sidekiq_processes.md
Created January 14, 2020 10:13
Removing orphaned processes on Sidekiq

Removing orphaned processes on Sidekiq

Sometimes your Sidekiq processes exit prematurely and the process name is still showing on Sidekiq UI, you have to remove it manually in Redis.

  1. Access Redis from cli
redis-cli your-redis-server-url
  1. Sidekiq uses processes set to store processes ids, so list them with SMEMBERS
@narze
narze / karabiner.json
Created November 25, 2019 06:46
karabiner.json from my goku
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@narze
narze / karabiner_merge.sh
Created June 7, 2019 12:32
Merge karabiner.json with complex modification rules
#!/usr/bin/env bash
# Requirements : goku, jq
# 1. Make sure goku runs
goku
# 2. Make temp json file
cp ~/.config/karabiner/karabiner.json ~/.config/karabiner/karabiner.tmp.json
@narze
narze / require_external.rb
Last active April 5, 2019 05:17
Load external gem (out of Gemfile) into Rails console
def require_external(gem_name=nil, gem_version="*", gem_libdir="lib")
gem_dir = Dir["#{`gem env gemdir`.strip}/gems/#{gem_name}-#{gem_version}"].first
raise "Gem '#{gem_name}' version '#{gem_version}' not found" if gem_dir.nil?
gemlib = Dir["#{gem_dir}/#{gem_libdir}/#{gem_name}.rb"].first
raise "Gem lib file '#{gemlib}' not found" if gemlib.nil?
puts "Loading gem '#{gem_name}' version '#{gem_version}' from #{gemlib}"