Skip to content

Instantly share code, notes, and snippets.

View shuuji3's full-sized avatar
🌈
🌎 🌟 🦚 🌌 ✨

TAKAHASHI Shuuji shuuji3

🌈
🌎 🌟 🦚 🌌 ✨
View GitHub Profile
@shuuji3
shuuji3 / copy-emoji-names.js
Last active January 2, 2022 09:03
Copy emoji names added by "Neutral Face Emoji Tools".
# Run on the page: https://<your-sub-domain>.slack.com/admin/emoji
[...document.querySelectorAll('.uploads > .upload.success > .filename')].map(e => `:${e.textContent.split('.').slice(0, -1).join()}:`).join(' ')
// => ':mochi-4: :mochi-spin-fast:'
@shuuji3
shuuji3 / encfs.rb
Last active August 23, 2021 03:21
2021-07-24 Enable the Homebrew encfs formula for macOS: download and run `brew install -s encfs.rb`
# Based on https://github.com/Homebrew/homebrew-core/blob/05e74086b48d6c4fab2dc4e3319cb09513e27125/Formula/encfs.rb
# ref. Error: encfs has been disabled because it requires FUSE! Β· Issue #630 Β· vgough/encfs - https://github.com/vgough/encfs/issues/630
class Encfs < Formula
desc "Encrypted pass-through FUSE file system"
homepage "https://vgough.github.io/encfs/"
url "https://github.com/vgough/encfs/archive/v1.9.5.tar.gz"
sha256 "4709f05395ccbad6c0a5b40a4619d60aafe3473b1a79bafb3aa700b1f756fd63"
# The code comprising the EncFS library (libencfs) is licensed under the LGPL.
# The main programs (encfs, encfsctl, etc) are licensed under the GPL.
@shuuji3
shuuji3 / maps.html
Last active August 1, 2021 16:44
Cesium map experiment using GSI of Japan and two drone images
<!DOCTYPE html>
<head>
<style>
iframe { width: 100%; height: 100vh }
</style>
</head>
<body>
<iframe src="https://sandcastle.cesium.com/#c=tZVtb9s2EMe/ysEvUhvwSPlBbpzawdpkKDo0a7Fk7bppKBjpLHOhSI08uVEMf/eRUurYSVqgBfpKoO+B//vx7rwSFlYSP6GFOWj8BCfoZFWwd81v3aSTNucTo0lIjTbp9GGdaABZiBxt/daalczQHu0G/2HVBRalEoSv9t26TSxAZdURJJ0lUemOOC9owHJjcoUsNQVfEVe1dfPi4Hq+vt4c1PN1vTm4ma9vNv7+NkNqMSNJIcvLJhLOROmSTrBueo0TobVe9J3EW3k+1Ct7b6zKLlqX7hrarBb/q9DRe2+3Z8JdHQHZCvt7xndoCa9/M7YQyt06wPbaTe9ZohPNOTzPMhAaBFopFBSiBLOAl+evwudXUQrNEt2iZ7cwX4sarWMiy+5jC+m/CTDnDeInW8IeDsud9JjZvyW/rm+4Q1EodK5cGjLcs+WeNfekWanzJ/3tQ8HX02jUmWlyDKPB9Et5wnNJCqlOfzmLn0PwhZ/2cPjjF65pk2x6ib4P988Pf4EK1Bh8N0z4Gk34jBNqUQgykEqqYSmU2mnkLZ7MGo2X0mYsl7SsLpk03IjiYxsbQn3dk4W0jhZK5kvi+5ZoGu1aP2Lp8mkUTQejx7neIfkBjXRXero0iwrISwUrV34JfEPpZK7q0BlPfW3DJlE0CH1D0vfew6rgwUu/MNbLAeGHdltmKgq0gjmksKfans/8aEotSBq9nfTfMSWhw1pZWFOcYm4RXXcwmrJp1IdRzKZxH5pj3B7HOyN8LnSWCkc+2oO8MEZdCvuiIjLa78W/T0PB0DT+P3DSEArPGBbkotJp0AHdXrss92UvVH1hPg/qjmzY6j4RfsU4KfTogfB43Cid+M8gjqJey+vZd6n+cNf
@shuuji3
shuuji3 / slack-count-activated-members.js
Created July 5, 2021 08:08
Count the number of members by the status of activation. Run "Manage members" page of the Slack admin page: https://your-channel-name.slack.com/admin. Note that the member list is load asynchronously so you can only count the members shown in the page.
const counter = { Active: 0, Inactive: 0, Deactivated: 0 }
const activationStatuses = [...document.querySelectorAll('.p-admin_member_table_row_item--status')]
activationStatuses.forEach(e => counter[e.textContent]++)
console.log(counter)
// => {Active: 10, Inactive: 20, Deactivated: 30}
@shuuji3
shuuji3 / unicode-emoji-recently-added-image-downloader.js
Last active June 18, 2021 13:22
Download Emoji v14 beta emojis with hyphen-connected filenames. Run in the console on the following page: Emoji Recently Added, v14.0Ξ² - https://www.unicode.org/emoji/charts-14.0/emoji-released.html
// Should run at
// Emoji Recently Added, v14.0Ξ² - https://www.unicode.org/emoji/charts-14.0/emoji-released.html
// ref. javascript - Force browser to download image files on click - Stack Overflow - https://stackoverflow.com/questions/17527713/force-browser-to-download-image-files-on-click
function toDataURL(url) {
return fetch(url)
.then((response) => {
return response.blob();
})
.then((blob) => {
@shuuji3
shuuji3 / sync-time-and-timezone-on-rhel-7.bash
Created May 7, 2021 05:54
Sync the current time with the RHEL NTP server pool and set the timezone to Japan standard time.
#!/usr/bin/env bash
sudo ntpdate 0.rhel.pool.ntp.org 1.rhel.pool.ntp.org
sudo timedatectl set-timezone Asia/Tokyo
timedatectl
#!/usr/bin/env bash
# Downloads wallpaper images used by Chromecast
# ref. https://stackoverflow.com/a/37840948/1204782
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
mkdir -p img/
wget https://raw.githubusercontent.com/dconnolly/chromecast-backgrounds/master/README.md -O README.md
@shuuji3
shuuji3 / parseHTML.js
Created April 16, 2021 10:46
Parse a HTML string as a DOM object
// ref. DOMParser - Web APIs | MDN - https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
function parseHTML(htmlString) {
return new DOMParser().parseFromString(htmlString, 'text/html')
}
#!/usr/bin/env bash
rm index.html
wget -m -nd https://www.cs.tsukuba.ac.jp/lecture/midterm/local/20_data/ 2> download.log
# Show results
echo -n 'Success: '
egrep ' saved |Omitting download.' download.log | wc -l
echo -n 'Failed: '
grep '404 Not Found' download.log | wc -l
@shuuji3
shuuji3 / kubernetes-website-diff-ae05ac0..cdad56a-configmap.md.diff
Created July 29, 2020 08:09
git diff ae05ac0..cdad56a content/en/docs/concepts/configuration/configmap.md > kubernetes-website-diff-ae05ac0..cdad56a-configmap.md.diff
diff --git a/content/en/docs/concepts/configuration/configmap.md b/content/en/docs/concepts/configuration/configmap.md
index 23d2a9dbe..d7d2feb9d 100644
--- a/content/en/docs/concepts/configuration/configmap.md
+++ b/content/en/docs/concepts/configuration/configmap.md
@@ -60,7 +60,7 @@ metadata:
name: game-demo
data:
# property-like keys; each key maps to a simple value
- player_initial_lives: 3
+ player_initial_lives: "3"