This file contains 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
/** | |
* Returns the current resident set size (physical memory use) measured | |
* in bytes, or zero if the value cannot be determined on this OS. | |
*/ | |
size_t getCurrentRSS( ) | |
{ | |
long rss = 0L; | |
FILE* fp = NULL; | |
if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL ) | |
return (size_t)0L; /* Can't open? */ |
This file contains 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
pid=$(pidof $PROCNAME) | |
cat /proc/$pid/cmdline | xargs -0 echo |
This file contains 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
sudo apt-get install build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev qt5-default | |
wget http://www.makemkv.com/download/makemkv-oss-1.10.2.tar.gz | |
wget http://www.makemkv.com/download/makemkv-bin-1.10.2.tar.gz | |
tar -xvf makemkv-oss-1.10.2.tar.gz | |
tar -xvf makemkv-bin-1.10.2.tar.gz | |
cd makemkv-oss-1.10.2/ | |
./configure | |
make | |
sudo make install |
This file contains 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
#define PRINT_MACRO_HELPER(x) #x | |
#define PRINT_MACRO(x) #x"="PRINT_MACRO_HELPER(x) | |
#pragma message(PRINT_MACRO(MULTI_CACHE)) | |
#pragma message(PRINT_MACRO(_CACHE)) |
This file contains 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
(defun dotspacemacs/init () | |
(setq configuration-layer--elpa-archives | |
'(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/") | |
("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/") | |
("melpa-stable" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa-stable/") | |
("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/") | |
("marmalade" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/marmalade/"))) |
This file contains 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
cat /proc/modules | cut -f 1 -d " " | while read module; do | |
echo "Module: $module"; | |
if [ -d "/sys/module/$module/parameters" ]; then | |
ls /sys/module/$module/parameters/ | while read parameter; do | |
echo -n "Parameter: $parameter --> "; | |
cat /sys/module/$module/parameters/$parameter; | |
done; | |
fi; | |
echo; | |
done |
This file contains 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 | |
SQLITE3=sqlite3 | |
OLD_CHAT_LIST=$1 | |
NEW_CHAT_LIST=$2 | |
TGDATA_DB=$3 | |
usage() { | |
echo | |
echo "Usage:" |
This file contains 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 -e | |
math_calc() { | |
local format="$1" | |
local equation="$2" | |
echo | awk "{printf \"$format\", $equation}" | |
} | |
convert_to_bytes() { |
This file contains 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
set_force_check() { | |
export force_check=1 | |
if [ x"$1" = x"0" ]; then | |
force_check=0 | |
fi | |
} | |
print_stack() { | |
local wholepath=$1 | |
# to avoid noise we start with 2 to skip get_stack caller |
This file contains 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
# strip white spaces and tabs from string | |
string_trim() { | |
local str=$1 | |
echo "$str" | sed -E 's/^[ \t]*//' | sed -E 's/[ \t]*$//' | |
} | |
# convert string to lower case | |
string_lower() { | |
local str=$1 | |
echo "$str" | tr "[:upper:]" "[:lower:]" |
NewerOlder