Skip to content

Instantly share code, notes, and snippets.

View elliotwms's full-sized avatar
🏴󠁧󠁢󠁷󠁬󠁳󠁿

Elliot Williams elliotwms

🏴󠁧󠁢󠁷󠁬󠁳󠁿
View GitHub Profile
@elliotwms
elliotwms / gist:9249227
Last active August 29, 2015 13:56 — forked from Phrogz/gist:1290420
Feed The Beast Minecraft server as a service
#!/bin/bash
# /etc/init.d/minecraft
# version 0.3.4 2011-06-12 (YYYY-MM-DD)
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
@elliotwms
elliotwms / parse.py
Last active August 29, 2015 14:09
Parse a text file of websites into an SQL INSERT statement
#! /usr/bin/env python
f = open('output.sql', 'w');
f.write('INSERT INTO websites (url) VALUES\n')
for line in open("websites.txt",'r'):
f.write('(\''+line.strip()+'\'),\n')
f.close()
<input type="checkbox" name="option_a" value="">
<input type="checkbox" name="option_b" value="">
<input type="checkbox" name="option_c" value="">
<input type="checkbox" name="option_d" value="">
<input type="checkbox" name="option_e" value="">
<?php
// Long winded...
$option_a = $_POST['option_a'];
$option_b = $_POST['option_b'];
$option_c = $_POST['option_c'];
$option_d = $_POST['option_d'];
$option_e = $_POST['option_e'];
// Slightly better...
$options = [
<input type="checkbox" name="options[a]" value="">
<input type="checkbox" name="options[b]" value="">
<input type="checkbox" name="options[c]" value="">
<input type="checkbox" name="options[d]" value="">
<input type="checkbox" name="options[e]" value="">
<?php
$options = $_POST['options'];
// Now you can work with this just like an array!
foreach ($options as $option => $value)
{
echo "Option " . $option . " = " . $value . "!";
}
?>
<form id="youdeservearrays" action="index.php" method="post">
<input type="password" name="password[1]" value="Hello World">
<input type="password" name="password[2]" value="Hello Qorld">
</form>
<?php
if (count(array_unique($_POST['password'])) == 1) {
$password = $_POST['password'][0];
} else {
@elliotwms
elliotwms / Emmetparty.txt
Created February 4, 2015 11:31
Emmetparty
(h2+.table-responsive>table.table-bordered>thead>tr>th{Year}+th{Name}+th{Expires}^^+tbody>tr>td*3)*14
@elliotwms
elliotwms / categories.json
Last active October 2, 2015 23:51
iTunes Podcast Categories
[
{
"category": "Arts",
"subcategories": [
"Design",
"Fashion &amp; Beauty",
"Food",
"Literature",
"Performing Arts",
"Visual Arts"

Keybase proof

I hereby claim:

To claim this, I am signing this object: