Skip to content

Instantly share code, notes, and snippets.

justinc1

Block or report user

Report or block justinc1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@justinc1
justinc1 / sqlite-cheatsheet.md
Last active Jul 10, 2019
sqlite cheatsheet
View sqlite-cheatsheet.md
sqlite3 -readonly db.sqlite3 

.help
.quit
.databases
.dbinfo main
.tables

PRAGMA table_info([auth_user]);
View fprintf_pos.c
/*----------------------------------------------------------------------------*/
#define LOG_FUNCION_ENTER 1
static int call_depth = 0;
static FILE *dbg_outlog = NULL;
void dbg_open_log(void);
void dbg_open_log(void) {
if (dbg_outlog == NULL) {
dbg_outlog = stdout;
//outlog = fopen("outlog", "a+");
fprintf(dbg_outlog, "/*----------------------------------------*/\n");
@justinc1
justinc1 / ns-bash
Last active Apr 22, 2018
Execute bash in net namespace, with informative promt
View ns-bash
#!/bin/bash
set -eu
NS=$1
export PS1="[\u@\h \W] ($NS) \$ "
sudo ip netns exec $NS bash
@justinc1
justinc1 / hexdump.cc
Last active May 17, 2018
hexdump -C in C
View hexdump.cc
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
/*
Implement "hexdump -C" utility.
*/
void hexdump(void* ptr, size_t size, size_t addr0);
View plot-network-traffic
#!/bin/bash
# /home/justin_cinkelj/devel/mikelangelo/perf-test/dec-2016/3392.vsbase2.hlrs.de/
IND=./
OUTD=../outdata/
# individual files time span is:
# run1-node0101.pcap 10:45:05.192261 - 10:46:49.561470
# run1-node0102.pcap 10:45:20.754461 - 10:46:16.754582
# run1-node0103.pcap 10:45:02.345936 - 10:46:22.164012
View Makefile
OSV_SRC=../..
CPPLAGS += -std=c++11
## CPPLAGS += -I$(OSV_SRC) -I$(OSV_SRC)/include/ -I$(OSV_SRC)/arch/x64
CPP=c++ $(CPPLAGS) -ggdb
CPPSO=$(CPP) -fPIC -shared
GCC=gcc
GCCSO=$(GCC) -fPIC -shared
all: udp-rec udp-rec.so
@justinc1
justinc1 / autostart-vm.sh
Last active Sep 15, 2015
xen-ringwatch scrip, fixed int32/unit32
View autostart-vm.sh
#!/bin/bash
# justinc, autostart VMs after server reboot
# Only VMs with tag=autostart, or (in) appliance named autostart-vms
LOG=/root/autostart-vm.log
function main() {
# wait on working xapi
echo '************************************************'
@justinc1
justinc1 / dump-zimbra-user-cos.sh
Created Nov 7, 2014
prestej zimbra cos userje
View dump-zimbra-user-cos.sh
#!/bin/bash
# izpisi vse COS-e,
# izpisi cos, domeno, za vse userje
# $1 je 'name uuid cifrs', id==uuid
# imenam se ponavljajo
function cos_id_to_ind() {
ii=1
for cos_id in ${COS_ID[@]}
You can’t perform that action at this time.