Skip to content

Instantly share code, notes, and snippets.

View skriticos's full-sized avatar

Sebastian Bartos skriticos

  • pgsw.eu
  • Germany
View GitHub Profile
@skriticos
skriticos / decho.c
Created March 26, 2010 10:42
Slow print functions.
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
/* maximal size of printing (the rest is truncated) */
@skriticos
skriticos / manlike_formatter.py
Created September 8, 2009 10:03
manpage like formatter function for python 3
#! /usr/bin/env python3
# Note: this was just a little toying, rst2man is much better.
import string
import textwrap
def _fmt_help(name, title, description, *args):
"""
IN
" Seth Kriticos' vimrc file
" Last update: 2010-03-19
" Note - This configuration is for cterm mode (color terminal)
" Never got around liking the GUI version
" (problematic command line integration)
" For GUI use, the highlight commands should be adjusted
" Editor behaviour
set nocompatible
set autoread
#! /usr/bin/env python3
""" Terminal command shortcut scirpt.
This script reads a command data file (~/.scdata) and executes commands from it.
There are two command execution models:
1. by argement, if you invoke it with a number, it executes this command
and exits. If you invoke it with -e opion, it opens the command file
for editing and then enters the main loop.
2. by loop, if you invoke it withouth an argument, it prints the
availible commands and promts for command number (id) to execute.
#! /usr/bin/env python3
""" Linux / *NIX daemon base code.
This script daemonizes its self with the start option and kills an already
running daemon with the stop option. It's kept minimal and simple, but it works
and can be extended/re-factored as base-code for a useful daemon.
Note: point of daemons is that they are quite and run in the background, add
some logging if you are developing a daemon, saves a lot of headaches.
"""
#! /usr/bin/env python3
""" Cleaning script based on .gitignore file, the 'find' and 'rm' command.
It removes files with .gitignore pattern.
This script reads the .gitignore file, parses the patterns found there to a
shell remove command and then executes it.
- With the 'dirs' option it also removes directories.
- With the 'debug' option it just prints the command it would execute and exits.
#! /usr/bin/env python3
""" Fifo read/write handler snipet
Opens the file 'thefifo' for reading and writing. Writes something to the
fifo and then enters the read loop. The data written will be recovered
unless some other process is reading the file, as the delay will allow the
other process to read it. (Try '% cat thefifo' before running the script.)\
"""
import os, time, sys, atexit
#! /bin/bash
# This was a bit toying around with bootstrapping based on autotools.
LIBRARY=0
fn_print_help ()
{
echo "NAME"
echo " bootstrap - create acme programming project"
echo
#!/bin/bash
# I think I must have been really bored when I wrote this litte script.
# Well, it is a good reference for true/false evaluation.
echo
echo "Testing \"0\""
if [ 0 ] # zero
then
echo "0 is true."
#! /bin/bash
# This script searches for suspicious files in the paths ${DEFAULT_DIRS[@]} or in TARGET.
# It can also remove them. Based on blacklist and whitelist's.
#################
### VARIABLES ###
#################