This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function token_to_array() { | |
local -n array=$1 | |
local str=$2 | |
local i=0 c quote start=0 | |
while [ $i -lt ${#str} ]; do | |
c=${str:$i:1} | |
case "$c" in | |
\\) i=$(( i + 1 )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defscrollback 10000 | |
autodetach on | |
vbell on | |
hardstatus alwayslastline | |
hardstatus string '%{= kg}[ %{y}%H %{g}][%= %{=kw}%?%-w%?%{y}(%{W}%n*%t%?(%u)%?%{y})%{g}%?%+w%?%?%= %{g}][ %{y}%Y-%m-%d %{W}%c %D %{g}]' | |
escape ^Aa | |
#shell bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <time.h> | |
#define NSUB (1L<<32) | |
#define NBIT 48 | |
//#define NSUB (1<<4) | |
//#define NBIT 8 | |
#define COUNT(isub, iseg) (isub*((long)NSUB)+iseg) | |
#define PRINT_COUNT(msg, count) printf("%s: iSub= %ld\tcount= %ld\tr1= %ld\tr2=%ld\telapse= %f\n", msg, isub, count, r1, r2, elapse) | |
#define PRINT(msg) PRINT_COUNT(msg, COUNT(isub, iseg)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo ?= default | |
override foo += added | |
export foo | |
all:: | |
@echo outer: foo is "$(foo)" | |
@$(MAKE) -s -f sub-make.mk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function ensure_privileged_or_exit() { | |
local cap_mask="0x00000007ffffffff" | |
local cap_bnd=0x$(grep ^CapBnd /proc/self/status | awk '{print $2}') | |
if [[ $(($cap_mask & $cap_bnd )) != $(($cap_mask)) ]]; then | |
echo -e "[ERROR] Run with --privileged option." | |
exit 1 | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Change fn + esc to grave_accent_and_tilde", | |
"rules": [ | |
{ | |
"description": "Change fn + esc grave_accent_and_tilde", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "escape", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim -c TOhtml -c wq -c q TxJSON.cxx | |
vim -c 'hardcopy > o1.ps' -c q TxJSON.cxx | |
a2ps --pro=color -o o2.ps TxJSON.cxx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------- == ------------------------------------------------- == | |
nench.sh v2018.04.14 -- https://git.io/nench.sh == nench.sh v2018.04.14 -- https://git.io/nench.sh == | |
benchmark timestamp: 2018-11-18 10:05:43 UTC == benchmark timestamp: 2018-11-18 10:06:45 UTC == | |
------------------------------------------------- == ------------------------------------------------- == | |
== == | |
Processor: Intel(R) Xeon(R) CPU E5-2687W v4 @ 3.00GHz == Processor: Virtual CPU 714389bda930 == | |
CPU cores: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find "$1" -d | while read x; do | |
basename=$(basename "$x") | |
dirname=$(dirname "$x") | |
newname=$(echo $basename | iconv -c -f utf-8 -t cp866 | iconv -f cp949 -t utf-8) | |
if [ "$basename" != "$newname" ];then | |
mv "$dirname/$basename" "$dirname/$newname" | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
# Basic recursion | |
def fibonacci (n): | |
def imp (n): | |
if n == 0: return 0 | |
if n == 1: return 1 | |
return imp(n-1) + imp(n-2) |
NewerOlder