Skip to content

Instantly share code, notes, and snippets.

View adyp's full-sized avatar

Adrian Penișoară adyp

View GitHub Profile
@adyp
adyp / allocator.c
Last active December 5, 2017 23:12
Memory allocator tester
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEFAULT_UNIT 1024*1024 /* 1Mb */
size_t alloc_unit;
char* format_size(unsigned long int);
@adyp
adyp / gist:e016cb0bf6e8f0c1882a
Created October 28, 2015 20:43
shell: close stdin before executing command
exec 0>&- # close stdin
# and execute command without STDIN control...
@adyp
adyp / bashrc_svn
Created August 7, 2014 16:21
PROMPT_COMMAND for SVN repo information (from mixed sources and additional tweaking)
# Include SVN info in prompt, if possible
PROMPT_COMMAND=svn_prompt_cmd
svn_prompt_cmd() {
# The various escape codes that we can use to color our prompt.
RED="\e[0;31m"
GREEN="\e[0;32m"
BROWN="\e[0;33m"
BLUE="\e[0;34m"
@adyp
adyp / tailurl.bash
Last active August 9, 2024 13:13 — forked from habibutsu/tail.sh
Improved version of the "tailurl" utility to "tail" a file published via an URL: allows user/password authentication; can use password file; variable read chunk size, in order to keep up with real filling rate (e.g. busy logs); support for "-f / -F / -s" similar to the classic "tail" utility; supports idle timestamping (iChat style); supports ex…
#!/bin/bash
#
# Source: https://gist.github.com/bsdcon/7224196
# Original: https://gist.github.com/habibutsu/5420781
# Modified by Adrian Penisoara << ady+tailurl (at) bsdconsultants.com >>
#
# Last update: 8 Aug 2014
#