Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

/c/ympfh cympfh

🏠
Working from home
View GitHub Profile
View tochiji_vote_rate_20200705.yml
---
title: 2020/07/05 都知事選の確定投票率
result:
- name: 文京区
rate: 62.98
source: https://www.city.bunkyo.lg.jp/kusejoho/senkyo/r02tochiji/r2tochiji.html
- name: 豊島区
rate: 54.82
source: https://www.city.toshima.lg.jp/361/kuse/senkyo/2006191019.html
- name: 千代田区
@cympfh
cympfh / int64.awk
Last active Jan 16, 2020
64bit signed int
View int64.awk
BEGIN {
E = 10000
}
function int64(x, _, i, xs, sign) {
if (substr(x, 1, 1) == "-") {
sign = -1
x = substr(x, 2, length(x) - 1)
} else {
sign = 1
}
View fuck-iptables.sh
#!/bin/bash
for i in $(seq 8000 8900); do
iptables -I INPUT 6 -p tcp -m tcp --dport $i -j ACCEPT
done
iptables -L --line-numbers
View kill_builtin_keyborad_while_bluetooth_keyboard_available.sh
#!/bin/bash
BUILTIN_KBD_NAME="AT Translated Set 2 keyboard"
BLUETOOTH_KBD_NAME="HHKB-Hybrid_"
xinput set-prop "$BUILTIN_KBD_NAME" "Device Enabled" 1
trap "xinput set-prop '$BUILTIN_KBD_NAME' 'Device Enabled' 1; exit" 2
STATUS=none
View shot-pages.sh
#!/bin/bash
REGION_X=2928
REGION_Y=507
REGION_W=864
REGION_H=1220
WIN_MID_X=3200
WIN_MID_Y=1000
HASH_PREV=1
View web.listening.you.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Speech-to-Text</title>
<script>
function echo(text) {
var style = 'color: #884488; font-weight: bold; font-size: 20px; \
text-shadow: #dddddd 2px 0px, #dddddd -2px 0px, #dddddd 0px -2px, \
View sqrt.tch.rs
extern crate tch; // https://github.com/LaurentMazare/tch-rs
use tch::{Tensor, no_grad};
fn sqrt(v: f64) -> f64 {
let mut x = Tensor::from(v / 2.0).set_requires_grad(true);
let lambda = 0.01;
for _ in 0..100 {
let y = &x * &x - v;
let loss = &y * &y;
x.zero_grad();
View neoki.sh
#!/bin/bash
URL=http://s.cympfh.cc/cympfh/sleep
OUT=./neoki.png
last_status=NONE
datfile=$(mktemp)
curl -s $URL | while read t status; do
date_ymd=$(date -d "$t" "+%Y%m%d")
View cors-anywhere.sh
#!/bin/bash
HEADER=$(mktemp)
BODY=$(mktemp)
REQ=$(mktemp)
FIFO=/tmp/fifo.$$
mkfifo $FIFO
trap "rm -f $HEADER $BODY $REQ $FIFO; exit" INT
View magic-bingo.js
function iota(n, begin=0, step=1) {
var xs = [];
while (xs.length < n) {
if (xs.length == 0) {
xs.push(begin);
} else {
xs.push(xs[xs.length - 1] + step);
}
}
return xs
You can’t perform that action at this time.