View test_sqlite3_int_vs_stmt.cc
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 _MULTI_THREADED | |
#include <sqlite3.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <cstring> | |
#define SQLOK(line) do { \ |
View sample.c
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
https://stackoverflow.com/questions/7272558/can-we-define-a-new-data-type-in-a-gdb-session | |
// sample.c | |
#include "sample.h" | |
struct sample foo; | |
gcc -g -c sample.c | |
(gdb) add-symbol-file sample.o 0 | |
add symbol table from file "sample.o" at |
View test_sqlite5.cc
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 _MULTI_THREADED | |
#include <sqlite3.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
int print_row_cb(void *NotUsed, int argc, char **argv, char **azColName) { | |
NotUsed = 0; |
View test_sqlite3_int.cc
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 _MULTI_THREADED | |
#include <sqlite3.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
int callback(void *, int, char **, char **); | |
void check(const char *str, int err); | |
void *threadfunc(void *parm); |
View ruby_fork_pgkill_test.rb
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
$stdin.sync = true; | |
$stdout.sync = true; | |
$a = true | |
def handle(id, sig) | |
puts id.to_s + " got " + sig.to_s + " at " + Process.pid.to_s | |
$a = false | |
end |
View gist:b12f4710eb3445aa993ed7782b88a3b5
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 /etc/systemd/logind.conf | |
# This file is part of systemd. | |
# | |
# systemd is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published by | |
# the Free Software Foundation; either version 2.1 of the License, or | |
# (at your option) any later version. | |
# | |
# Entries in this file show the compile time defaults. |
View fork_reaper.c
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> | |
#include <unistd.h> | |
#include <sys/prctl.h> | |
int main() { | |
printf("origin: pid=%d, ppid=%d, pgid=%d\n", getpid(), getppid(), getpgid(getpid())); | |
printf("prctl %d\n", prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0)); | |
pid_t pid = fork(); |
View setns.c
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 _GNU_SOURCE /* See feature_test_macros(7) */ | |
#include <sched.h> | |
#include <sys/syscall.h> /* Definition of SYS_* constants */ | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/wait.h> | |
#include <time.h> |
View docker_pg_pgb.sh
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
docker run --rm --name pg -e POSTGRES_PASSWORD=123 -e POSTGRES_HOST_AUTH_METHOD=md5 postgres:latest | |
docker run --rm -e DATABASE_URL="postgres://postgres:123@172.17.0.2/postgres" -e POOL_MODE=session -p 5432:5432 --name pgb -it edoburu/pgbouncer /usr/bin/pgbouncer /etc/pgbouncer/pgbouncer.ini -v | |
psql postgres://postgres:123@pgb/ | |
# by default latest versions of PG use SASL+SCRAM-SHA-256 that is not support by the pgbouncer docker image |
View mmap.c
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 <errno.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <unistd.h> |
NewerOlder