Skip to content

Instantly share code, notes, and snippets.

View iomz's full-sized avatar
❤️‍🔥

Iori Mizutani iomz

❤️‍🔥
  • University of St.Gallen
  • St.Gallen, Switzerland
  • 09:38 (UTC +02:00)
  • X @iomz
View GitHub Profile
@iomz
iomz / fri13.py
Created April 12, 2012 13:28
Jason's day
Months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
Days = [31,29,31,30,31,30,31,31,30,31,30,31]
DateDict = dict(zip(Months,Days))
WeekDayList = ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
weekinitializer = [0,0,0,0,0,0,0]
monthinitializer = [0,0,0,0,0,0,0,0,0,0,0,0]
Thirteens = dict(zip(WeekDayList, weekinitializer))
JasonCount = []
JasonMonthCount = dict(zip(Months, monthinitializer))
@iomz
iomz / HadamardMatrixMaker.py
Created July 19, 2012 14:29
Takes an interger n for 2^n x 2^n Hadamard matrix
#!/usr/bin/env python
# Takes an interger n for 2^n x 2^n Hadamard matrix
import numpy as np
import sys
def recursiveKronecker(k, hmat):
if 2**(k-1) == 1:
return hmat
else:
@iomz
iomz / stay_over.py
Last active April 24, 2016 16:04
gist: 2383539 in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SFC-SFS "Report for overnight stay" script
# Last modified: 4/12/2016
#
# **Fisrt complete the values below**
# =begin===========================================================
login = "" # Ex. "s58000yf"
passwd = "" # Ex. "yukichifukuzawa" (passwd is hardcoded here)
@iomz
iomz / LICENSE.txt
Created July 24, 2012 13:09 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@iomz
iomz / felica_dump.c
Created April 16, 2013 05:57
Read card ID (IDm) by Pasori reader and send it by socket communication
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@iomz
iomz / duplicate_dynamodb_table.py
Created March 26, 2014 00:21
Duplicate a table in AWS DynamoDB (for renaming or manual fix)
from boto.dynamodb2.exceptions import ValidationException
from boto.dynamodb2.fields import HashKey, RangeKey
from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2.table import Table
from boto.exception import JSONResponseError
from time import sleep
import sys
if len(sys.argv) != 3:
print 'Usage: %s <source_table_name> <destination_table_name>' % sys.argv[0]
@iomz
iomz / keio_gpa.py
Created April 4, 2014 01:37
Grade report parser for Keio University web system
#!/usr/bin/python
# -*- coding: utf-8 -*-
from HTMLParser import HTMLParser
from re import match
Grades = {
u'\uff21': 'A',
u'\uff22': 'B',
u'\uff23': 'C',
u'\uff30': 'P'
@iomz
iomz / rename_photos_like_dropbox.sh
Last active August 29, 2015 13:58
Rename photos in the specified directory like Dropbox's "Camera Upload" based on last modified dates
#!/bin/sh
ABSPATH=$(cd "$1"; pwd)
COUNT=0
if [ ! -e $ABSPATH ]; then
echo "*** $ABSPATH doesn't exist! ***"
exit
fi
for F in $ABSPATH/*; do
@iomz
iomz / gist:a0d5f86eceee39e110c0
Created January 25, 2015 07:46
Node-RED: door-demo
[{"id":"68bf71d.f97409","type":"mongodb","hostname":"YOURHOST","port":"00000","db":"YOUR_DB","name":"IBMCloud MongoDB"},{"id":"f8a512bc.075af","type":"websocket-listener","path":"/ws/door","wholemsg":"false"},{"id":"bd385f48.42c7a","type":"debug","name":"device data","active":true,"complete":"true","x":290.83332443237305,"y":147.6666717529297,"z":"5cf8236b.a307dc","wires":[]},{"id":"731fcbfd.8ce034","type":"websocket out","name":"/ws/door","server":"f8a512bc.075af","x":757,"y":183,"z":"5cf8236b.a307dc","wires":[]},{"id":"443b3381.bbc4cc","type":"ibmiot in","authentication":"quickstart","apiKey":"","inputType":"evt","deviceId":"784b87a33025","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT App In","service":"quickstart","allDevices":"","allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":"","x":95,"y":148,"z":"5cf8236b.a307dc","wires":[["bd385f48.42c7a","136e1892.ec91e7"]]},{"id":"136e1892.ec91e7","type":"function","name":
@iomz
iomz / gif-iot-demo.json
Last active May 2, 2019 01:38
gif-iot-demo for Node-RED
[{"id":"20ea5e9c.df15a2","type":"mqtt-broker","broker":"lain.sfc.wide.ad.jp","port":"1883","clientid":""},{"id":"e6455180.19bab","type":"function","name":"pwm1","func":"return {\n\tpayload: {\n\t\tid: 1,\n\t\tangle: Math.floor(msg.payload.pwm1)\n\t}\n};","outputs":1,"x":510,"y":80,"z":"8c26fbba.73d908","wires":[["5df8adb5.a20754","bc0f8744.43f078"]]},{"id":"b0f29aba.4f0d68","type":"function","name":"pwm0","func":"return {\n\tpayload: {\n\t\tid: 0,\n\t\tangle: Math.floor(msg.payload.pwm0)\n\t}\n};","outputs":1,"x":510,"y":40,"z":"8c26fbba.73d908","wires":[["5df8adb5.a20754","bc0f8744.43f078"]]},{"id":"bc0f8744.43f078","type":"mqtt out","name":"openblocks14/servo","topic":"gif-iot/cmd/78:4B:87:AA:9A:74/servo","qos":"0","retain":"false","broker":"20ea5e9c.df15a2","x":811,"y":80,"z":"8c26fbba.73d908","wires":[]},{"id":"df42383c.20bdc8","type":"mqtt in","name":"gif-iot/data/78:A5:04:8C:29:BA","topic":"gif-iot/data/78:A5:04:8C:29:BA","broker":"20ea5e9c.df15a2","x":139.5,"y":40,"z":"8c26fbba.73d908","wires":[["91da0