Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bijanebrahimi's full-sized avatar

bijan bijanebrahimi

View GitHub Profile
@bijanebrahimi
bijanebrahimi / dn_validator.c
Last active May 25, 2018 14:40
Distinguished-Name validator in pure C
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define PARSER_KEY 0x001
#define PARSER_VALUE 0x002
#define PARSER_ESC 0x004
#define PARSER_SPACE 0x008
@bijanebrahimi
bijanebrahimi / README.md
Created February 20, 2017 14:03
A guide to dtrace in FreeBSD

An introduction

what's dtrace?

DTrace dynamic tracing compiler and tracing utility DTrace is a comprehensive dynamic tracing framework for the Solaris Operating System. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.

How to enable dtrace?

@bijanebrahimi
bijanebrahimi / gitlab.sh
Last active February 20, 2017 14:00
Enable graphviz on gitlab markdown language
$ nano /etc/gitlab/gitlab.rb
nginx['custom_nginx_config'] = "include /var/opt/gitlab/nginx/conf/webtools.zharfpouyan.net;"
$ nano /var/opt/gitlab/nginx/conf/webtools.zharfpouyan.net
server {
listen *:80;
server_name webtools.zharfpouyan.net;
access_log /var/log/webtools.zharfpouyan.net.access.log;
error_log /var/log/webtools.zharfpouyan.net.error.log;
@bijanebrahimi
bijanebrahimi / cross-compiler.sh
Last active April 17, 2024 19:54
build a linux cross compiler for FreeBSD targets
#!/bin/bash
export TARGET=amd64-marcel-freebsd9.2
export PREFIX=/usr/cross-build
export TARGET_PREFIX=$PREFIX/$TARGET
export PATH=$PATH:$PREFIX/bin
mkdir -p $TARGET_PREFIX{,/lib,/include}
mkdir build-{binutils,gmp,mpfr,mpci,gcc}
@bijanebrahimi
bijanebrahimi / log.c
Last active September 17, 2016 19:11
simple logging in c
#include <math.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include "log.h"
struct testss{
u_long level;
const char *name;
} log_names[] = {
@bijanebrahimi
bijanebrahimi / config
Created February 28, 2016 14:41
My py3status configuration
bar {
...
status_command py3status -c ~/.config/i3/i3status.conf
font pango:DejaVu Sans Mono, Awesome 10
...
}
@bijanebrahimi
bijanebrahimi / i3-config
Last active October 7, 2018 14:53
Run terminator as a drop-down tiling terminal in i3-wm using scratchpad
# Add this to your i3 config (~/.config/i3/config) and restart i3 (Super+Shift+R)
exec --no-startup-id "terminator -m"
for_window [class="Terminator" title="^((?!Terminator Preferences).)*$"] move scratchpad, move position 0 0, resize set 1366 768;
bindsym F1 [class="Terminator"] scratchpad show;
@bijanebrahimi
bijanebrahimi / css2odtstyle.sh
Created February 11, 2016 21:55
a bash script to convert pygment css styles to odt style xml format.
#!/bin/sh
CSS=$1
read -r -d '' SNIPPET << EOM
<style:style style:name="codehilite" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="">
<loext:graphic-properties draw:fill="solid" draw:fill-color="\2" draw:fill-image-width="0in" draw:fill-image-height="0in"\/>
<style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" fo:orphans="0" fo:widows="0" fo:text-indent="0in" style:auto-text-indent="false" style:page-number="auto" fo:background-color="\2" fo:padding="0.0201in" fo:border="0.06pt solid \2" fo:keep-with-next="auto" style:snap-to-layout-grid="false" style:writing-mode="page">
<style:tab-stops\/>
<\/style:paragraph-properties>
@bijanebrahimi
bijanebrahimi / movie_organizer.py
Last active December 23, 2019 19:25
imdb movie organizer
#~/usr/bin/env python2
import os
import re
import imdb
import pickle
# TODO: use logger
ia = imdb.IMDb()
# TODO: expand ~/
cache_dir = "/home/bijan/.imdbpy/cache"