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
/* | |
Original here https://www.technovelty.org/linux/poking-around-in-auxv-part-2.html | |
Changed for x64 | |
gcc read-auxv.c -o read-auxv | |
./read-auxv <PID> | |
*/ | |
#define _GNU_SOURCE | |
#include <stdio.h> |
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 | |
# !!! PREREQUISITES !!! | |
# chmod u+x ~/bin/flac.sh | |
# | |
# sudo apt install cuetools shntool enca | |
# | |
# sudo add-apt-repository -y ppa:flacon | |
# sudo apt-get update | |
# sudo apt-get install -y flacon |
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
#if __GNUC__ >= 3 | |
# define likely(x) __builtin_expect(!!(x), 1) | |
# define unlikely(x) __builtin_expect(!!(x), 0) | |
#else | |
# define likely(x) (x) | |
# define unlikely(x) (x) | |
#endif |
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
struct test_t { | |
int a; | |
char b; | |
int c; | |
} __attribute__((__packed__)); |
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
#include <stdio.h> | |
int* foo(void); | |
int* foo2(void); | |
char* bar(void); | |
char* bar2(void); | |
int main(int argc, char* argv[]) | |
{ |
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
import locale | |
from datetime import datetime, timedelta | |
try: | |
locale.setlocale(locale.LC_TIME, '%s.UTF-8' % lang) | |
except Exception as e: | |
logger.error("Error setting exception", lang=lang, exception=e) | |
# English locale | |
locale.setlocale(locale.LC_TIME, 'en_US.UTF-8') |
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
### gcc -std=c11 -O0 -Wall -o measure_time measure_time.c | |
#include <stdio.h> | |
#include <time.h> | |
int main() | |
{ | |
clock_t start = clock(); | |
for (int i = 0; i < 10000; i++) | |
i += 1; |
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
/* http://habrahabr.ru/company/intel/blog/200658/ | |
gcc -O0 -Wall mulsd.c | |
./a.out | |
4.000000 2.000000 | |
*/ | |
#include <stdio.h> | |
int main() { | |
double a[2] = {2, 2}, b[2] = {0, 0}; |
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
/* | |
http://blog.kazuhooku.com/2015/05/how-to-properly-spawn-external-command.html | |
https://github.com/h2o/h2o/blob/08e6f20b0e85b830f6334253b72735bb15980dab/lib/common/serverutil.c | |
*/ | |
pid_t safe_spawnp(const char *cmd, char **argv) | |
{ | |
int pipefds[2] = {-1, -1}, errnum; | |
pid_t pid; | |
ssize_t rret; |
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
""" | |
$ gdb --args ./python /home/user/src/python/stop_gdb.py | |
(gdb) run | |
""" | |
import os | |
import signal | |
signal.signal(signal.SIGTRAP, lambda *args, **kwargs: None) | |
stop = lambda: os.kill(os.getpid(), signal.SIGTRAP) |
OlderNewer