Skip to content

Instantly share code, notes, and snippets.

@TacoSteemers
TacoSteemers / gist:11060507
Last active August 29, 2015 14:00
backuppc installation
In my setup, /var/lib/backuppc is a soft link to a directory on a different filesystem, lets say /backup
Problem one: could not start the service
Solved by setting
chmod g+s /backup
chown -R backuppc /backup
Problem two: web interface would not come up
Solved by running (as root):
@TacoSteemers
TacoSteemers / minimal_fork_test.c
Created October 23, 2012 19:10
Minimal Linux and Windows process spawn test
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <process.h> /* Required for _spawnv */
#include <windows.h>
/* We make getpid() work in a similar
way on Windows as it does on Linux */
#define getpid() GetCurrentProcessId()
#endif
@TacoSteemers
TacoSteemers / cleanup.py
Created April 1, 2013 14:35
Small scipy/numpy/pyplot script to clean up a monochrome drawing and show the input and output side by side
import numpy
from scipy import misc
import matplotlib.pyplot as plt
if __name__ == "__main__":
input = 'input.png'
output = 'output.png'
# Editing
imIn = misc.imread(input)
@TacoSteemers
TacoSteemers / gist:5378038
Last active December 16, 2015 04:38
Adding author name/link to WP Vintage Camera theme. content.php for main page, and content-single.php for the one post view
Just before the tags:
...
<footer class="entry-meta">
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<span>Written by: <?php the_author_link(); ?></span>
...
or just before the date:
@TacoSteemers
TacoSteemers / gist:5382459
Created April 14, 2013 12:03
Rust 0.6 crash event log
Log Name: Application
Source: Application Error
Date: 4/14/2013 1:55:24 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: taco-PC
Description:
@TacoSteemers
TacoSteemers / gist:5455651
Created April 24, 2013 21:16
python inspect object
import pdb, inspect
...
for m in inspect.getmembers(object):
print m
pdb.set_trace()
@TacoSteemers
TacoSteemers / gist:5560959
Last active December 17, 2015 05:49
Partitioning and mounting a disk on a Debian system
What is present?
$ fdisk -l
To edit the partitions on /dev/sdz:
$ fdisk /dev/sdz
Follow the instructions.
Remove the partitions you want to remove, create new ones in their place.
Make sure to verify and write.
Then, update the kernel:
$ partprobe /dev/sdz
Then, create the filesystem(s):
@TacoSteemers
TacoSteemers / gist:5653440
Created May 26, 2013 17:32
grails integrate-with --git
$ cd to/grails/application/directory/
$ grails integrate-with --git
| Created Git '.gitignore' file..
$ cat .gitignore
*.iws
*Db.properties
*Db.script
.settings
stacktrace.log
/*.zip
@TacoSteemers
TacoSteemers / gist:5690179
Created June 1, 2013 12:14
Drive or partition clone
sudo dd if=/dev/sdb of=/dev/sdc bs=4096 conv=noerror
@TacoSteemers
TacoSteemers / gist:5716821
Created June 5, 2013 20:00
Set main / primary display when using X Window system and compatible driver
user@pc:~$ xrandr
Screen 0: minimum 320 x 200, current 3600 x 1080, maximum 8192 x 8192
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 640mm x 360mm
1920x1080 60.0*+ 50.0 30.0 25.0 24.0
1920x1080i 30.0 25.0
1280x1024 60.0
1360x768 59.8
1280x720 60.0 50.0
1440x576i 25.0
1024x768 60.0