Skip to content

Instantly share code, notes, and snippets.

View okwrtdsh's full-sized avatar

okwrtdsh okwrtdsh

View GitHub Profile

S: スタック

  1. S-S-(S|T)(S|T)+L: スタックに積む(S:正,T:負)(S:0,T:1)
  • S-TS-(S|T)+L: スタックの上からN番目の値を複製
  • S-TL-(S|T)+L: スタックの上から2番目以降をN個破棄
  • S-LS: a:b:[] -> a:a:b[]スタックの一番上の値を複製
  • S-LT: a:b:[] -> b:a:[]スタックの上の2つの値を交換
  • S-LL: a:b:[] -> b:[]スタックの一番上の値を破棄

TS: 数値演算

  1. TS-SS: a:b:[]->(b+a):[]
import java.io.InputStream
import java.io.File
fun String.binaryToUnsignedInt(): Int = this.fold(0) {
acc, c -> acc * 2 + if (c == 'T') 1 else 0
}
fun String.binaryToInt(): Int =
this.drop(1).binaryToUnsignedInt() * if (this.first() == 'S') 1 else -1
fun <T> MutableList<T>.pop(index: Int = 0) = this.removeAt(this.lastIndex - index)

ksnctf Programming write-up

http://ksnctf.sweetduet.info/problem/7

  1. 見るからにwhitespaceなので、以前作っていたwhitespaceのdebuggerで実行
  2. PIN:と聞かれる
  3. 1を答えたときのstackの様子を見てみる
$ runkotlin whitespace.kt program.cpp true
S-S-STSTSSSSL # stack push 80
TL-SS # io print char from 80: P

ksnctf Login write-up

http://ksnctf.sweetduet.info/problem/6

  1. adminでログインしろと言われるのでとりあえず、SQLインジェクション pass: ' OR 1=1;--
  2. adminのpasswordがflagだと言われる
  3. passwordの長さを求める pass: ' OR (SELECT length(pass) FROM user WHERE id='admin') < 22;--
  4. 21だと分かるので適当にconsoleでjsを書く
  • jQuery読み込む
"""
inspired by
https://github.com/harvitronix/five-video-classification-methods/blob/master/data.py
"""
import operator
import os
import random
import threading
from glob import glob

keras(tf backend)でgpuの設定

%matplotlib inline
import tensorflow as tf
from keras import backend as K
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.visible_device_list="0"
sess = tf.Session(config=config)
K.set_session(sess)
OVPN_DATA="ovpn-data"
VPN_SERVERNAME="server_name"
VPN_PORT=1194
VPN_CLIENTNAME="client_name"
echo "create volume..."
docker volume create --name $OVPN_DATA
echo "done."
echo "ovpn_genconfig..."
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://$VPN_SERVERNAME
echo "done."
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

atom plugins

autocomplete-mathjax
autocomplete
markdown-preview-enhanced
monokai-complete-syntax
plantuml-viewer
vim-mode-plus
language-plantuml

google chromeのinstall

sudo apt-get install libappindicator1
sudo dpkg -i google-chrome-stable_current_amd64.deb
(sudo apt-get install -f)

デスクトップの英語化