Skip to content

Instantly share code, notes, and snippets.

View goura's full-sized avatar

Kazuhiro Ogura goura

  • HENNGE
  • Tokyo, Japan
View GitHub Profile
@goura
goura / deepl_sh.sh
Last active July 30, 2023 10:21
A simple command line interface to the DeepL API.
#!/bin/bash
# A simple command line interface to the DeepL API.
# Author: Kazuhiro Ogura
# License: MIT
if ! command -v jq &> /dev/null; then
echo "You need jq to run this script. Try 'sudo apt install jq' on Ubuntu or 'brew install jq' on macOS."
exit
fi
api_key="$DEEPL_AUTH_KEY"
@goura
goura / furusato-sum.go
Last active February 5, 2023 07:37
Read Kifukinkoujo-ni-kansuru-shoumeisho (寄付金控除に関する証明書) from standard input and print items inside it
// Parse kifukinkoujoshoumeisho xml and print the donation entries inside it
// Disclaimer: This doesn't do XMLDsig verification
// Disclaimer: no warranty, use it at your own risk
//
// For example you can save this as furusato-sum.go and run it like
// $ cat aaaa.xml | go run furusato-sum.go | awk -F "\t" '{sum += $3} END {print sum}'
// To get the sum of the amount of donations inside the xml
package main

Keybase proof

I hereby claim:

  • I am goura on github.
  • I am goura (https://keybase.io/goura) on keybase.
  • I have a public key ASCqb7MUvIjlh2F5VWYfOqAAWfek_aYQd0dcQuLX05AitAo

To claim this, I am signing this object:

@goura
goura / regza_to_donki.ino
Created July 29, 2017 17:39
Arduino sketch to relay Toshiba REGZA remote signal to LE-5050TS4K-BK (Donki Generic Regza)
/*
* Arduino sketch to relay Toshiba REGZA remote signal
* to LE-5050TS4K-BK (Donki Generic Regza)
*/
// Uses IRLib2 https://github.com/cyborg5/IRLib2/
#include "IRLibAll.h"
// IR Receiver input is at pin 2 (this can be changed)
static const int RECEIVER_PIN = 2;
@goura
goura / ubuntu_ami_ids.sh
Last active May 11, 2016 17:53
Get a list of AMI IDs for a specific Ubuntu version
#/bin/sh
curl https://cloud-images.ubuntu.com/locator/ec2/releasesTable | jsonlint -Sf | jq '[.aaData[]|select(.[1]=="trusty" and .[3]=="amd64" and .[4]=="hvm:instance-store")|{region:.[0], ami_id:(.[6]|sub("<a [^<]+>"; "")|sub("</a>"; ""))}]'
# Based on the example code on http://razzpisampler.oreilly.com/ch07.html
import RPi.GPIO as GPIO
import urllib
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def button_pressed():
javascript:(function()%7Bfunction%20t(t)%7Bconsole.log(t);t.date.match(e);var%20n=RegExp.$1;var%20r=RegExp.$2;if(r.length%3C=1)r=%220%22+r;var%20i=RegExp.$3;if(i.length%3C=1)i=%220%22+i;var%20s=%22%22+n+%22/%22+r+%22/%22+i;var%20o=%5Bs,t.name,t.author,t.url%5D;return%20o.join(%22%5Ct%22)+%22%5Cn%22%7Dfunction%20n(e)%7Bvar%20t=window.open(%22%22,%22name%22,%22height=250,width=700%22);t.document.write(%22%3Chtml%3E%3Chead%3E%3Ctitle%3EAmazon%20to%20TSV%3C/title%3E%22);t.document.write(%22%3C/head%3E%3Cbody%3E%22);t.document.write(%22%3Cpre%3E%22);t.document.write(e);t.document.write(%22%3C/pre%3E%22);t.document.write(%22%3C/body%3E%3C/html%3E%22);t.document.close();return%20t%7Dfunction%20u(e)%7Bif(typeof%20e!==%22number%22)%7Bvar%20e=0;$(%22%3Cdiv/%3E%22).css(%7Bposition:%22fixed%22,left:0,top:0,width:%22100%25%22,height:%22100%25%22,zIndex:1e3,backgroundColor:%22rgba(0,0,0,.7)%22,color:%22%23fff%22,fontSize:30,textAlign:%22center%22,paddingTop:%2215em%22%7D).attr(%22id%22,%22___overlay%22).text(%22Amazon%E3%8
package main
import (
"fmt"
)
type IntInt struct {
A int
B int
}