This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Enumerate prime numbers below N using only SQL | |
-- DDL | |
create table primes( | |
value integer primary key, | |
sieved boolean not null default false | |
); | |
create index prime_sieve_idx on | |
primes(value, sieved); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -l shogun_kinds kamakura muromachi tokugawa | |
set -l pre_kamakura_shoguns 巨勢麻呂 多治比懸守 藤原宇合 藤原麻呂 藤原継縄 藤原小黒麻呂 大伴家持 紀古佐美 大伴弟麻呂 坂上田村麻呂 文屋綿麻呂 藤原忠文 源義仲 木曾義仲 | |
set -l kamakura_shoguns 源頼朝 源頼家 源実朝 藤原頼経 九条頼経 藤原頼嗣 九条頼嗣 宗尊親王 惟康親王 久明親王 守邦親王 | |
set -l kenmu_shoguns 護良親王 成良親王 足利尊氏(建武) | |
set -l nancho_shoguns 興良親王 宗良親王 尹良親王 | |
set -l muromachi_shoguns 足利尊氏 足利義詮 足利義満 足利義持 足利義量 足利義教 足利義勝 足利義政 足利義尚 足利義材 足利義澄 足利義稙 足利義晴 足利義輝 足利義栄 足利義昭 | |
set -l tokugawa_shoguns 徳川家康 徳川秀忠 徳川家光 徳川家綱 徳川綱吉 徳川家宣 徳川家継 徳川吉宗 徳川家重 徳川家治 徳川家斉 徳川家慶 徳川家定 徳川家茂 徳川慶喜 | |
set -l zou_shoguns 徳川綱重 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt --description 'Write out the prompt' | |
set -l color_cwd | |
set -l suffix | |
switch "$USER" | |
case root toor | |
if set -q fish_color_cwd_root | |
set color_cwd $fish_color_cwd_root | |
else | |
set color_cwd $fish_color_cwd | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Old Icon Name or Alias (Version 4) | New Icon Name (Version 5) | New Icon Prefix | Unicode value | |
---|---|---|---|---|
500px | 500px | fab | f26e | |
address-book-o | address-book | far | f2b9 | |
address-card-o | address-card | far | f2bb | |
adn | adn | fab | f170 | |
amazon | amazon | fab | f270 | |
android | android | fab | f17b | |
angellist | angellist | fab | f209 | |
apple | apple | fab | f179 | |
area-chart | chart-area | fas | f1fe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fontawesome-4-to-5.csv | |
# https://gist.github.com/homuler/e4c1e381cdab254d78b253ec9bc84870 | |
# | |
# Usage: | |
# ./fontawesome-4-to-5.sh COMMAND TARGET_DIR [--csv-path=] [...GREP_OPTIONS] | |
DIR=$(dirname "$PWD/$0") | |
COMMAND=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a PoC code to show how to print stack traces in C with line numbers. | |
// This code is based on [glibc/debug/backtracesymsfd.c](https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=debug/backtracesymsfd.c;hb=244b415d386487521882debb845a040a4758cb18) | |
/* Copyright (C) 1998-2022 Free Software Foundation, Inc. | |
This file is part of the GNU C Library. | |
The GNU C Library is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public | |
License as published by the Free Software Foundation; either | |
version 2.1 of the License, or (at your option) any later version. | |
The GNU C Library is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Android-related commands are somewhat not executable on Linux, so install them again. | |
# cf. https://forum.unity.com/threads/android-sdk-ndk-and-openjdk-arent-marked-with-executable-permission-on-linux.1238494/ | |
UNITY_EDITOR_ROOT="/path/to/Unity/Hub/Editor" | |
UNITY_EDITOR_VERSION="2021.3.3f1" | |
DESTINATION_ROOT="${UNITY_EDITOR_ROOT}/${UNITY_EDITOR_VERSION}/Editor/Data/PlaybackEngines/AndroidPlayer" | |
ANDROID_OPEN_JDK_URL=http://download.unity3d.com/download_unity/open-jdk/open-jdk-linux-x64/jdk8u172-b11_4be8440cc514099cfe1b50cbc74128f6955cd90fd5afe15ea7be60f832de67b4.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ThrottleOptions { | |
concurrency: number; | |
} | |
export async function throttledAll<T>(generator: Generator<Promise<T>>, options: ThrottleOptions): Promise<T[]> { | |
const { concurrency } = options; | |
if (concurrency <= 0) { | |
throw new Error(`concurrency must be greater than 0, but ${concurrency}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from fractions import Fraction | |
bingo5x5_seqs = [ | |
[1, 2, 3, 4, 5], | |
[6, 7, 8, 9, 10], | |
[11, 12, 13, 14], | |
[15, 16, 17, 18, 19], | |
[20, 21, 22, 23, 24], | |
[1, 6, 11, 15, 20], |