Skip to content

Instantly share code, notes, and snippets.

View loloicci's full-sized avatar

TAKASE Ryo (loloicci) loloicci

View GitHub Profile
@loloicci
loloicci / README.md
Last active November 14, 2019 11:32
unix-crypt-sha512

unix-crypt-sha512

command to make SHA512 password hash from stdin as crypt(3).

Options

  • -s: specifying salt.
  • -c: checking specified hash is valid for stdin.

Dependency

  • unix-crypt: unix-crypt-sha512.rb depends on it. To install, do gen install unix-crypt.
@loloicci
loloicci / example.nim
Last active November 7, 2019 08:28
Currying in nim
import currying
proc f(x, y: int) : int {.curried.} =
return x + y
doAssert (f(40) 2) == 42
doAssert (40.f 2) == 42
doAssert (40.f(2)) == 42
echo "Succeed"
@loloicci
loloicci / a.nim
Created April 20, 2019 17:21
ABC 2019/04/20
import strutils, sequtils
let
abc = stdin.readline.split({' '}).map(parseInt)
a = abc[0]
b = abc[1]
c = abc[2]
if (a < c and c < b) or (b < c and c < a):
echo "Yes"
@loloicci
loloicci / a.nim
Created April 13, 2019 15:28
ABC 2019/04/13
import strutils, sequtils
let
s = stdin.readline.split({' '})
var
sum = 0
a = s[0].parseInt
b = s[1].parseInt
#ThisScriptIsWrittenInPython2.7.WhenYouExecute,PleaseDoInPython2.7.NoteThatItDoesNotWorkInPython3.x.
W=" ";
U="_";
D='"'*3;
Q="'"*3;
S="<";
L="&";
T=">";
# スクリプトの実態
#ThisScriptIsWrittenInPython2.7.WhenYouExecute,PleaseDoInPython2.7.NoteThatItDoesNotWorkInPython3.x.
W=" ";U="_";D='"'*3;Q="'"*3;S="<";L="&";T=">";zc=r"""import<re,random,zlib,base64&f=['eNrtld0JgDAMhI
e 5wb L/FgqC9pI 0ptGK D
w 0I5 UL5zG+BZ WmT3e 6
UxViMxZjLsEbO44DzRH6Sz O8d QsC4LtJ3eaykIOKq 5KBY0 QbQRk CSYUT1IPlkqOu+pBE9hg0a
Thp8SXTz9BkIGT0JuiMmxM ENE c+HWw8EydcVlntGs a/ Il5jz wnz4mQ13yeicc+C1rZOQnq
28MQYmM+qLO82QbxiYzHjy xCU Z7z+jf7ENVaI+Qw= =','eNr dlkES gDAIAx/Th+X/v3Cc8dCGQN
GBHuRYq1tLCIzxk8Ad/qM6 Bk4 wcIKBEwycYKCZodV VzJCQao aClDM EpJ5hIQ0MA+lgMKSFQZAeh
iU69Zq9U1kYfHWZH37LYA3 4XW YV5CuGfHfjmbsOpE sPqW+Yj c/qnr HYS3wXtNEcyGfMPslysuF8
d+OFs+HnGEOr0bdC0x0TtS jV6 DuhaPNRPpTG+PTRw DCfKEas 6WUlh JOPU/JybUrhks1wThROhmj
import tables
type
CT = Table[string, int]
proc makeConstTable(): CT =
result = initTable[string, int]()
result.add("one", 1)
result.add("two", 2)
result.add("three", 3)
@loloicci
loloicci / comma_for_deliter_tech.sh
Last active February 26, 2019 07:44
an example to use commas as delimiters for 'for' in bash.
#!/bin/bash
CMD_LINE="ro root=/dev/example1,/dev/example2 splash quiet"
for CMD_PARAM in ${CMD_LINE}; do
case ${CMD_PARAM} in
root=*)
ROOT_DEV=${CMD_PARAM#root=}
;;
*)
import strutils
import sequtils
var
a = stdin.readline.parseInt
bc = stdin.readline.split.map(parseInt)
str = stdin.readline
echo "$1 $2" % [$(a + bc[0] + bc[1]), str]
@loloicci
loloicci / root-ro
Created June 8, 2017 04:52 — forked from niun/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
# Originally written by Axel Heider (Copyright 2012) for Ubuntu 11.10.
# This version can be found here:
# https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash#Overlayfs