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 | |
import argparse, re, csv | |
parser = argparse.ArgumentParser( | |
description='read csv files and print to stdout in vcf format', | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | |
parser.add_argument('-d', '--delimiter', type=str, default=',', | |
help='field delimiter character') | |
parser.add_argument('mapping', |
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
# ~/.mbsyncrc | |
# modified from https://www.cosroe.com/2024/05/neomutt-isync.html | |
# Global defaults that apply to all channels / accounts / stores | |
# Create in both places | |
Create Both | |
# Do not remove if missing in one place | |
Remove None | |
# Permanently delete those messages marked for deletion |
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 python3 | |
# https://stackoverflow.com/a/12803967 | |
# IMAP folder path encoding (IMAP UTF-7) for Python | |
import sys, re | |
from imapclient import imap_utf7 | |
for line in sys.stdin: | |
line = line.strip().encode('ascii') |
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
# lagrange points as seen using effective potential plot | |
len(x,y) = sqrt(x*x+y*y) | |
# mass of planet relative to that of star | |
alpha = 0.01 # "mu" in wikipedia | |
# mass of star and mass of planet | |
Ms = 1000 | |
Mp = Ms * alpha |
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
ACTIVE_BORDER_COLOR="#ffff80" | |
INACTIVE_BORDER_COLOR="#80c080" | |
TITLE_HEIGHT=18 | |
for i in 1 2 3 4 5 ; do convert -size 24x$TITLE_HEIGHT xc:$ACTIVE_BORDER_COLOR title-$i-active.png ; done | |
convert -size 2x$TITLE_HEIGHT xc:$ACTIVE_BORDER_COLOR top-left-active.png | |
convert -size 2x$TITLE_HEIGHT xc:$ACTIVE_BORDER_COLOR top-right-active.png | |
convert -size 2x16 xc:$ACTIVE_BORDER_COLOR left-active.png | |
convert -size 2x16 xc:$ACTIVE_BORDER_COLOR right-active.png | |
convert -size 16x2 xc:$ACTIVE_BORDER_COLOR bottom-active.png |
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 | |
# usage: split-gmail.pl test.mbox | |
# split test.mbox, a file exported from gmail, into one mail per file, named m0001.mbox, m0002.mbox, ... | |
$fn = sprintf("m%04d.mbox", 1); | |
open(FH, '>', $fn) or die $!; | |
$N = 0; | |
while (<>) { | |
# a sample string we are matching against: |
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
body { color: #000; background: #ffd; } | |
.center { text-indent: 0; text-align: center; } | |
.right { text-indent: 0; text-align: right; } | |
/* https://www.geeksforgeeks.org/how-to-create-an-html-checkbox-with-a-clickable-label/ */ | |
input[type=checkbox] { display: none } | |
.for-checkbox { | |
background-color: #eec; |
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
<?php | |
# 範例參數: | |
# bus-pos.php?line=Taichung/151 | |
# 其他城市名稱請見 | |
$QS = array_key_exists('QUERY_STRING', $_SERVER) ? $_SERVER["QUERY_STRING"] : ''; | |
parse_str($QS, $Q); | |
# $Q = array( | |
# 'line' => 'Taichung/151' | |
# ); |
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
# Enter a python3 interpreter. Then do this: | |
# exec(open('linespector.py').read()) | |
# And try, line by line, the commented out code at the end. | |
# Wonderful reference: | |
# https://cosmocode.io/how-to-connect-selenium-to-an-existing-browser-that-was-opened-manually/ | |
# ( found from here: https://stackoverflow.com/a/70088095 ) | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options |
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 an experimental piece of code for reading messages | |
# from the "line" messaging app as an extension of chrome. | |
# https://chrome.google.com/webstore/detail/line/ophjlpahpchlmihnnnihgmmeilfjmjjc?hl=zh-TW | |
# My linux is LMDE 5 (elsie), and my chromium is 113.0.5672.63, | |
# directly installed with apt install. | |
# I have also done: | |
# pip3 install selenium webdriver-manager beautifulsoup4 | |
# To use this program: | |
# 0. Create a line account if you don't have one. | |
# Note: Line is control-hungry. |
NewerOlder