Skip to content

Instantly share code, notes, and snippets.

@kunst1080
kunst1080 / steam-to-google-calendar.gs
Last active May 28, 2021 14:17
Steamで遊んだ時間をGoogleカレンダーに記録する
const CALENDAR_ID = "YOUR_CALENDAR_ID";
const STEAM_ID = "YOUR_STEAM_ID";
const STEAM_API_KEY = "YOUR_STEAM_API_KEY";
function run() {
const api = new SteamApi(STEAM_API_KEY);
const json = api.getPlayerSummary(STEAM_ID);
const gameid = json["gameid"];
const gameextrainfo = json["gameextrainfo"];
#include stdio.h
#include stdlib.h
#include fts.h
#include string.h
#include sys/stat.h
unsigned long get_inode(char *name) {
unsigned long inode;
struct stat stat_buf;
char path[255];
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
unsigned long get_inode(char *name) {
unsigned long inode;
struct stat stat_buf;
char path[255];
@kunst1080
kunst1080 / ShellScriptInBAT.bat
Last active April 24, 2017 14:47
ShellScript in Windows BAT
@rem '
@echo off
set P="/mnt/%~f0"
set P=%P:\=/%
set P=%P::=%
set P=%P:/mnt/C/=/mnt/c/%
set P=%P:/mnt/D/=/mnt/d/%
bash.exe %P% %*
@kunst1080
kunst1080 / open
Created April 24, 2017 12:52
open explorer in Bash on Ubuntu on Windows (BoW)
#!/bin/bash
if [ $# -eq 0 ]; then
DIR=.
else
DIR=$*
fi
explorer.exe $DIR
@kunst1080
kunst1080 / JavaFizzBuzz.java
Created April 15, 2017 07:31
Java FizzBuzz
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
IntStream.range(1, 100).boxed()
.map(n -> n % 15 == 0 ? "FizzBuzz"
: n % 5 == 0 ? "Buzz"
: n % 3 == 0 ? "Fizz"
: n)
.forEach(System.out::println);
@kunst1080
kunst1080 / ch_bg_color.sh
Created April 11, 2017 13:14
change background color for iTerm (Mac)
#!/bin/bash
R=$1
G=$2
B=$3
/usr/bin/osascript <<EOF
tell application "iTerm"
tell current session of current window
set background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))}
@kunst1080
kunst1080 / Makefile
Last active September 3, 2016 07:26
Hello world
boot.bin: boot.asm
nasm -f bin boot.asm -o boot.bin
qemu: boot.bin
qemu-system-x86_64 -curses boot.bin
clean:
rm *.bin
@kunst1080
kunst1080 / Application.java
Last active May 27, 2016 07:44
Play2.5 Java Controller Sample
private FormFactory formFactory;
private Form<SearchForm> form() {
return formFactory.form(SearchForm.class);
}
public Result index() {
val form = new SearchForm();
return ok(views.html.index.render(form().fill(form)));
}
@kunst1080
kunst1080 / gist:3706d19a2bc948611d39ecb490a917ec
Last active November 7, 2017 14:47
マイナンバーシェル芸(文字列結合ではなく数値計算でチェックデジットを計算する) のメモ
seq 1 99999999999 | awk '{
for(i=1;i<=11;i++){
a=int($0/(10^(i-1)));
b=a-int(a/10)*10;
if(i<=6){
sum+=b*(i+1)
} else {
sum+=b*(i-5)
}
};