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/sh | |
# a hackish script to convert this MS sql server script: | |
# https://www.dofactory.com/sql | |
# to a sqlite script | |
# | |
# usage: | |
# 1. ./ms2sqlite.sh sample-model.sql > model-sqlite.sql | |
# 2. edit model-sqlite.sql and manually: | |
# 2.1 remove all the "if exists ..." |
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
#!/usr/bin/python3 | |
# window manager must not enable auto-focusing! | |
# 視窗管理員不可啟用 「焦點跟隨滑鼠」! | |
import re, subprocess | |
F = open('/tmp/nextwindow.log', 'a') | |
winlist = subprocess.run(['wmctrl', '-l'], stdout=subprocess.PIPE) | |
winlist = winlist.stdout.decode('utf-8').split('\n') | |
winlist = [ re.sub('(\S+\s+){3}', '', w) for w in winlist ] |
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
#!/usr/bin/python3 | |
# 立委選舉統計資料轉檔 | |
# 詳見 https://newtoypia.blogspot.com/2020/01/xlsxlsx-csv.html | |
import sys, re, argparse | |
import pandas as pd | |
from numpy import isnan | |
from warnings import warn |
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
#!/usr/bin/perl -w | |
# plurk mail summary | |
# plurk-sent mail | |
# => *.mbox (by gmail) | |
# => *.html (by hypermail) | |
# => *.txt (by lynx -dump) | |
# => plk-ms.perl | |
# e.g. | |
# hypermail -m plurk.mbox -d plurk | |
# for f in plurk/????.html ; do lynx -dump $f | perl plk-ms.perl ; done | sort > ~/plurk-summary.txt |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/python3 | |
# randomly pick n samples from each word/directory | |
# of speech_commands_v0.02/ data set: | |
# https://download.tensorflow.org/data/speech_commands_v0.02.tgz | |
# usage: subsample.py -f -n 300 * > ~/list.txt | |
# tar czf ~/dsc.tgz $(cat ~/list.txt) | |
import argparse, os, random | |
from warnings import warn |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
ServerAdmin 貴哥的電子郵件信箱 | |
DocumentRoot /var/www/html/abc | |
ServerName abcdef.frdm.info | |
ErrorLog ${APACHE_LOG_DIR}/abcdef/error.log | |
CustomLog ${APACHE_LOG_DIR}/abcdef/access.log combined | |
Header set Access-Control-Allow-Origin "*" | |
SSLCertificateFile /etc/letsencrypt/live/frdm.info/fullchain.pem | |
SSLCertificateKeyFile /etc/letsencrypt/live/frdm.info/privkey.pem |
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
#!/usr/bin/env node | |
// http://toddhayton.com/2018/08/01/scraping-with-puppeteer/ | |
// airtw-scraper.js https://www.cwb.gov.tw/V7/observe/real/46757.htm > a.htm | |
const homedir = require('os').homedir(); | |
const puppeteer = require(homedir + '/node_modules/puppeteer'); | |
const url = 'https://airtw.epa.gov.tw/'; | |
async function main() { | |
const browser = await puppeteer.launch(); |
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
#!/usr/bin/env node | |
// http://toddhayton.com/2018/08/01/scraping-with-puppeteer/ | |
// usage example: | |
// ./pptscraper.js https://www.cwb.gov.tw/V7/observe/real/46744.htm > a.htm | |
const homedir = require('os').homedir(); | |
const puppeteer = require(homedir + '/node_modules/puppeteer'); | |
const url = process.argv[2]; | |
const sel = process.argv[3]; | |
async function main() { |