Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@joakimk
joakimk / pxe_server_install.sh
Created October 12, 2010 16:41
Script to install a PXE boot server for diskless clients
# This installs a PXE boot server.
#
# It's based on https://help.ubuntu.com/community/DisklessUbuntuHowto.
# It's been used with ubuntu-10.10-server-amd64.iso and ubuntu-10.10-server-i386.iso.
#
# It requires two network cards. One for access to the outside world and one
# for a private network of PXE clients. I've choosen this setup to not cause problems
# with DHCP on the normal network.
#
# It also requires that you have a second partition mounted on /nfsroot.
@dougalcampbell
dougalcampbell / phpfpm-mon.cron
Created February 14, 2012 19:45
Crontab entry to monitor for php-fpm problems
## Auto-restart PHP when it's returning errors
#
# Make sure that http://localhost/test.php is an actual PHP script. If it starts returning
# 500 errors, restart the PHP-FPM service
* * * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || /usr/sbin/service php5-fpm restart

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mashdot
mashdot / README.md
Created April 5, 2012 17:00
Bacula concurrent jobs multiple storage devices client labeled pools debian installation configuration.
Time-stamp: <2012-03-30 Fri 16:56 README.md>
Author....: 'Mash (Thomas Herbert)

TOSHINE-BACULA

Bacula concurrent jobs multiple storage devices client labeled pools Debian installation and configuration.
Please see http://toshine.org/etc for full article.

Bacula Debian Installation.

@dAnjou
dAnjou / flask-upload
Created June 5, 2012 12:35
Flask upload example
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@13rac1
13rac1 / ansible-create-user-with-password
Created March 18, 2013 22:18
Create a user in an Ansible playbook with a set, but unknown password so the account is not locked. Makes it possible to log on the account with a public key. This example requires mkpasswd, but that can be replaced with any other password generator.
---
- hosts: all
gather_facts: yes
##
# Create the password then create the user
#
- name: Users | Generate password for new user
shell: makepasswd --chars=20
register: user_password
@willurd
willurd / web-servers.md
Last active July 23, 2024 17:12
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@kirikaza
kirikaza / fix-git-packfiles.sh
Created August 7, 2013 21:08
Fixes unaccessable packfiles in the git repo, i.e. errors like "packfile .git/objects/pack/pack-<hash>.pack cannot be accessed". If there are no such packfiles, the script just does "git gc". It is safe enough. See http://stackoverflow.com/a/14571150/421146
#!/bin/bash
packlist=`mktemp`
git gc 2>&1 |
grep '^warning: packfile .* cannot be accessed$' |
cut -d' ' -f3 |
sort -u > $packlist
packs_count=`wc -l < $packlist`
temp=`mktemp`