Skip to content

Instantly share code, notes, and snippets.

View iwatakeshi's full-sized avatar
📚
Always learning

Takeshi iwatakeshi

📚
Always learning
View GitHub Profile
@iwatakeshi
iwatakeshi / Ruby with chruby
Created October 20, 2023 14:40 — forked from rubyandcoffee/Ruby with chruby
chruby - Installing and managing Ruby versions
To install chruby and ruby-install:
brew install chruby ruby-install
To install Ruby using ruby-install:
ruby-install ruby 2.7.1
NOTE: You can find latest stable version of Ruby here: https://www.ruby-lang.org/en/downloads/
If you have issues installing Ruby then try the following:
brew install openssl@3
ruby-install 3.2.2 -- --with-openssl-dir=$(brew --prefix openssl@3)
@iwatakeshi
iwatakeshi / tilix_ubuntu_guide.md
Created March 7, 2023 20:21 — forked from agtbaskara/tilix_ubuntu_guide.md
Installation Guide for Tilix on Ubuntu

Install Tilix on Ubuntu 20.04

Install Tilix

sudo apt-get install tilix

Fix Tilix VTE

sudo ln -s /etc/profile.d/vte-2.91.sh /etc/profile.d/vte.sh
sudo chmod +x /etc/profile.d/vte.sh
@iwatakeshi
iwatakeshi / $.ts
Created February 27, 2023 02:55 — forked from lawrencecchen/$.ts
next-auth with remix
// app/routes/api/auth/$.ts
import NextAuth from "~/lib/next-auth/index.server";
export const { action, loader } = NextAuth({
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
],
@iwatakeshi
iwatakeshi / raspberry_fast_capture.py
Created October 10, 2022 20:22 — forked from CarlosGS/raspberry_fast_capture.py
Fast reading from the raspberry camera with Python, Numpy, and OpenCV. See the comments for more details.
# Fast reading from the raspberry camera with Python, Numpy, and OpenCV
# Allows to process grayscale video up to 124 FPS (tested in Raspberry Zero Wifi with V2.1 camera)
#
# Made by @CarlosGS in May 2017
# Club de Robotica - Universidad Autonoma de Madrid
# http://crm.ii.uam.es/
# License: Public Domain, attribution appreciated
import cv2
import numpy as np
@iwatakeshi
iwatakeshi / google_login.ts
Created August 14, 2021 02:10 — forked from Brandawg93/google_login.ts
Login to Google Account via Puppeteer
import puppeteer from 'puppeteer-extra';
import pluginStealth from 'puppeteer-extra-plugin-stealth'; // Use v2.4.5 instead of latest
import * as readline from 'readline';
puppeteer.use(pluginStealth());
// Use '-h' arg for headful login.
const headless = !process.argv.includes('-h');
// Prompt user for email and password.
@iwatakeshi
iwatakeshi / RS256.sh
Last active October 14, 2020 04:32 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
# https://gist.github.com/ygotthilf/baa58da5c3dd1f69fae9#gistcomment-2932501
# 2048 bits
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem
# 4096 bits
openssl genrsa -out private.pem 4096
openssl rsa -in private.pem -pubout -out public.pem
@iwatakeshi
iwatakeshi / macro_fun.exs
Created May 10, 2020 03:43 — forked from rcdilorenzo/macro_fun.exs
Macro fun in Elixir mimicking Ruby's attr_accessor
defmodule MacroExp do
defmacro attr_accessor(atom) do
getter = String.to_atom("get_#{atom}")
setter = String.to_atom("set_#{atom}")
quote do
def unquote(getter)(data) do
data |> Map.from_struct |> Map.get(unquote(atom))
end
def unquote(setter)(data, value) do
data |> Map.put(unquote(atom), value)
@iwatakeshi
iwatakeshi / service-workers.md
Created April 20, 2020 17:12 — forked from Rich-Harris/service-workers.md
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@iwatakeshi
iwatakeshi / iso-3166-1_codes.ex
Created March 21, 2020 20:15 — forked from delameko/iso-3166-1_codes.ex
ISO 3166-1 (alpha 2) country codes, in an Elixir list
country_codes = [
%{ iso_3166_1: "AF", name: "Afghanistan" },
%{ iso_3166_1: "AX", name: "Aland Islands" },
%{ iso_3166_1: "AL", name: "Albania" },
%{ iso_3166_1: "DZ", name: "Algeria" },
%{ iso_3166_1: "AS", name: "American Samoa" },
%{ iso_3166_1: "AD", name: "Andorra" },
%{ iso_3166_1: "AO", name: "Angola" },
%{ iso_3166_1: "AI", name: "Anguilla" },
%{ iso_3166_1: "AQ", name: "Antarctica" },