Skip to content

Instantly share code, notes, and snippets.

View alxschwarz's full-sized avatar

Alexander Feller alxschwarz

View GitHub Profile
@alxschwarz
alxschwarz / lwp.conf
Created October 7, 2013 14:15
LXC Web Panel Upstart script
#!upstart
description "Upstart script for LXC Web Panel "
author "Alexander 'AlexFinn' Ivanov <[email protected]>"
start on net-device-up
stop on shutdown
script
WORK_DIR="/srv/lwp"
@alxschwarz
alxschwarz / detect_crash.py
Created August 28, 2012 06:49
Detect Crash Dump
#!/usr/bin/python
import os
import subprocess
import shutil
import socket
def detect_coredump():
os.chdir("/var/crash")
return os.path.isfile("_var_games.0.crash")
@alxschwarz
alxschwarz / gist:3128734
Created July 17, 2012 11:02
String replace in file
def string_replace(init_string, replace_string, file_name)
file = File.new(file_name)
lines = file.readlines
file.close
changes = false
x = 0
lines.each do |line|
changes = true if line.sub!(init_string, replace_string)
end