Skip to content

Instantly share code, notes, and snippets.

kunst1080 kunst1080

View GitHub Profile
View mv-and-check-inode-fts.c
#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];
View mv-and-check-inode.c
#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 Apr 24, 2017
ShellScript in Windows BAT
View ShellScriptInBAT.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 Apr 24, 2017
open explorer in Bash on Ubuntu on Windows (BoW)
View open
#!/bin/bash
if [ $# -eq 0 ]; then
DIR=.
else
DIR=$*
fi
explorer.exe $DIR
View JavaFizzBuzz.java
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 Apr 11, 2017
change background color for iTerm (Mac)
View ch_bg_color.sh
#!/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 Sep 3, 2016
Hello world
View Makefile
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
Play2.5 Java Controller Sample
View Application.java
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 Nov 7, 2017
マイナンバーシェル芸(文字列結合ではなく数値計算でチェックデジットを計算する) のメモ
View gist:3706d19a2bc948611d39ecb490a917ec
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)
}
};
@kunst1080
kunst1080 / SimpleWebServer.java
Created Apr 12, 2015
Simple Web Server (Java)
View SimpleWebServer.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.util.Scanner;
import java.net.ServerSocket;
import java.net.Socket;
You can’t perform that action at this time.