Skip to content

Instantly share code, notes, and snippets.

View svandragt's full-sized avatar
🤞

Sander van Dragt svandragt

🤞
View GitHub Profile
@svandragt
svandragt / example-adts-aac.liq
Created July 25, 2016 20:33
Liquidsoap example ADTS-AAC
set("log.file",false)
set("log.stdout",true)
source_url = "http://localhost:8000/traktor.ogg"
output_host = "example.com"
output_port = 8124
output_pass = "mypassword"
s = input.http(buffer=4.0,source_url)
@svandragt
svandragt / github-webhook-deploy.php
Created July 29, 2016 10:10 — forked from frippz/github-webhook-deploy.php
Github webhook PHP script
<?php
try {
// Decode JSON data from Github
$payload = json_decode($_REQUEST['payload']);
}
catch(Exception $e) {
exit(0);
}
// Deploy live if push was on master branch
@svandragt
svandragt / getting_started.sh
Created September 13, 2016 09:21
Getting started on a new linux server
#!/bin/sh
sudo su
# fix hostname
nano /etc/hostname
hostname -F /etc/hostname
echo "#12.34.56.78 plato.example.com plato
#127.0.0.1 localhost.localdomain localhost" | cat - /etc/hosts > /tmp/hosts && mv /tmp/hosts /etc/hosts
nano /etc/hosts
@svandragt
svandragt / add_virtualhost.sh
Created September 13, 2016 09:25
add virtual host
#!/bin/bash
# version 1.0.0 - 21 march 2012
echo "Enter Hostname:"
read AVS_HOSTNAME
echo
echo "Enter webmaster email for '${AVS_HOSTNAME}':"
read AVS_WEBMASTER
echo
echo "Generating directories in ${HOME}/projects/${AVS_HOSTNAME}..."
@svandragt
svandragt / 404.html
Created September 13, 2016 09:36
codeigniter2 template has such elegance in css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
@svandragt
svandragt / mysite_code_dataobjects_MyDataObject.php
Created November 15, 2016 10:55
AjaxUniqueTextField Example
<?php
class MyDataObject extends DataObject
{
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Place a unique value constraint MyDataObjects table, MyCode column
$myAjax = new MyAjaxUniqueTextField('MyCode', 'My Code', 'MyCode', 'MyDataObject', "", null, null, null, $this->ID);
@svandragt
svandragt / .bashrc
Last active January 6, 2017 16:13
Linux Server Configuration and Setup History Repository
# binit - new backup repository
# bcom <filename> - backup file to git repo keeping path
# bex <command> - execute command and log the command to history
#
# Add this to .bashrc then use the above commands. Still does not work as well as ansible I presume.
backup_commit() {
# backup file if argument is provided
if [ "$#" -gt 0 ]
then
@svandragt
svandragt / autoexec.cfg
Created August 3, 2017 10:47
Urban Terror Config
// Bindings
bind x "weapnext"
bind z "+movedown"
bind ENTER "ui_selectgear"
// Funstuff
funfree patch,pimpbk,pbeard
funred patch,pimpbk,pbeard
funblue patch,pimpbk,pbeard
@svandragt
svandragt / site-disable.sh
Last active August 31, 2017 13:17
Site management scripts.
#!/bin/bash
# exit if not 1 argument
if [[ $# -ne 1 ]] ; then
echo 'This script accepts 1 argument.'
exit 1
fi
rm /etc/nginx/sites-enabled/$1
sudo nginx -t && sudo service nginx reload
@svandragt
svandragt / instructions.md
Last active August 31, 2017 13:40
Do eet

WordPress Migration into Network

The following example migrates archies.amasan.co.uk into the amasan.co.uk network.

Requirements

site management scripts

Directions

Backup the original site: