Skip to content

Instantly share code, notes, and snippets.

View skriticos's full-sized avatar

Sebastian Bartos skriticos

  • pgsw.eu
  • Germany
View GitHub Profile
#! /bin/bash
# 2014-04-22, v1.0, pull, push, initial clone of projects
# 2014-04-26, v2.0, speed improvement, use hashtable to determine push/pull
# automatically pull new projects based on remote hashtable
# setting up new repo (note: we should automate this at some point):
# create local git repo in projects (~/projects/xxx_name)
# login remote, create git repo $remote/"$target".git
# local git remote add "$remote"/
#! /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 ###
#################
#!/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 was a bit toying around with bootstrapping based on autotools.
LIBRARY=0
fn_print_help ()
{
echo "NAME"
echo " bootstrap - create acme programming project"
echo
#! /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
#! /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
""" 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.
@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
@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 / __init__.py
Created March 30, 2010 10:35
Python test runner.
# Python test runner. Add more tests with the test_sequence list.
# This assumes that the project to be tested is two folders above (../..)
# POSIX only
import os
import sys
import shutil
NAME = "TEMPLATE"