Skip to content

Instantly share code, notes, and snippets.

View ceremcem's full-sized avatar

Cerem Cem ASLAN ceremcem

View GitHub Profile
#!/bin/bash
screen -wipe
screen -mdS mytest bash -c 'for i in {1..10}; do echo "this is $i" > myfile; sleep 1; done'
PID=$(screen -list | grep mytest | cut -f1 -d'.' | sed 's/\W//g')
echo "PID is: $PID"
pause () {
echo "pausing process $PID"
kill -STOP $PID
@ceremcem
ceremcem / tmux-cheatsheet.markdown
Created July 2, 2017 20:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ceremcem
ceremcem / fizzbuzz.ls
Created September 5, 2017 00:13 — forked from ykhs/fizzbuzz.ls
fizzbuzz with LiveScript
global <<< require \prelude-ls
fizzbuzz = (x) ->
| x % 15 is 0 => \fizzbuzz
| x % 5 is 0 => \buzz
| x % 3 is 0 => \fizz
| otherwise => x
[1 to 100] |> map fizzbuzz |> each console.log
@ceremcem
ceremcem / package-lock-diff.patch
Created September 12, 2017 20:36
some description
diff --git a/package-lock.json b/package-lock.json
index 8aec82b..aa149be 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,16 @@
"through2": "2.0.3"
}
},
+ "JSONStream": {
+ "version": "1.3.1",
@ceremcem
ceremcem / package-lock-diff.patch
Created September 12, 2017 20:37
some description
diff --git a/package-lock.json b/package-lock.json
index 8aec82b..aa149be 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,16 @@
"through2": "2.0.3"
}
},
+ "JSONStream": {
+ "version": "1.3.1",
@ceremcem
ceremcem / stdin
Created September 16, 2017 17:57
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 28 release
keycode 56 press
keycode 82 press
keycode 72 press
keycode 81 press
@ceremcem
ceremcem / livescript-async-for-loop.ls
Last active October 3, 2017 12:20
Livescript async `for-loop` example
sleep = (ms, f) -> set-timeout f, ms
console.log "started"
<~ sleep 1000ms
i = 0; _count = 5
<~ :lo(op) ~>
console.log "hello", i
return op! if ++i >= _count
<~ sleep 1000ms
const registry = {};
const Async = Ractive.proxy(handle => {
const proxy = {};
const outer = handle.proxy.template;
const name = outer.m.find(a => a.n === 'async-name').f;
let placeholder = (outer.f || []).find(e => e.e === 'loading');
if (placeholder) placeholder = placeholder.f;
else placeholder = ['loading...']; // default placeholder

1. Prepare yourself

Everything may go wrong in this process. Make backups, prepare a live distribution that can connect to internet.

2. Prepare a new rootfs

Sync your current root filesystem to another location, eg. /NEW_ROOTFS

  1. Edit /NEW_ROOTFS/etc/fstab to mount proper devices
  2. Edit your rootfs synchronization tool (smith-sync, btrbk, dcs-tools, snapper, ...) config to backup between correct devices
cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 1020015 iterations per second for 256-bit key
PBKDF2-sha256 1133595 iterations per second for 256-bit key
PBKDF2-sha512 881156 iterations per second for 256-bit key
PBKDF2-ripemd160 758738 iterations per second for 256-bit key
PBKDF2-whirlpool 536630 iterations per second for 256-bit key
# Algorithm | Key | Encryption | Decryption
aes-cbc 128b 522.5 MiB/s 2229.3 MiB/s
serpent-cbc 128b 40.5 MiB/s 390.7 MiB/s