Skip to content

Instantly share code, notes, and snippets.

@sleepdeprecation
sleepdeprecation / reader.java
Created October 27, 2011 03:49
Read and send data - server style
// This is used inside of my own parseCommand(InputStream inStream, OutputStream outStream) method.
// The method has some other stuff included, but his is the gist of it.
// I changed some stuff up so that it would be more universal.
//
// This protocol uses \n as the end of a command, you can change that by changing the variable
// protocolEOL.
char protocolEOL = "\n";
String inStr = "";
@sleepdeprecation
sleepdeprecation / duplicate-select-list.html
Last active March 20, 2024 15:39
Duplicate a select list using jQuery
<!DOCTYPE html>
<html>
<head>
<title>Duplicate a select list using jQuery</title>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="selectScript.js"></script>
</head>
<body>
<div id="d1">
@sleepdeprecation
sleepdeprecation / new_post.py
Created December 22, 2011 00:27
New Jekyll Post
# new post
# setup some global things yourself...
timezone = "-0600"
layout = "default"
from sys import argv
import datetime, os
now = datetime.datetime.now()
@sleepdeprecation
sleepdeprecation / images.json.php
Created December 23, 2011 22:27
jQuery, PHP, and a directory of images
<?php
// used to display a json file with all of the images in a directory listed as img[x].url
$idir = $_GET['dir'];
$idir = "img/$idir/*";
echo "{\n";
echo "\"imgs\": [\n";
$ar = glob($idir);
@sleepdeprecation
sleepdeprecation / display.php
Created January 2, 2012 02:40
Display all pages from a drupal site
<?php
$q = "
SELECT node.vid,node_revisions.title,node_revisions.body from node_revisions,node WHERE node_revisions.vid = node.vid and node.type = 'page'
";
$c = mysql_connect("[host]", "[user]", "[pass]");
mysql_select_db("[db name]");
$r = mysql_query($q, $c);
@sleepdeprecation
sleepdeprecation / feed.xml
Created April 16, 2012 03:42
mynt RSS Feed
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.title }}</title>
<description>{{ site.title }}</description>
<link>{{ site.base_url }}</link>
<language>en-us</language>
<pubDate>{{ posts[0].timestamp|date('%a, %d %b %Y %H:%M:%S -0600') }}</pubDate>
<lastBuildDate>{{ none|date('%a, %d %b %Y %H:%M:%S -0600') }}</lastBuildDate>
@sleepdeprecation
sleepdeprecation / makeme.py
Last active December 15, 2015 01:19
A static-site generator, custom built for my host of subdomains (or, soon to be host of subdomains)
#!/usr/bin/env python2
'''
Make Me (makeme), a custom static-site generator thingy built by
Don Kuntz <http://don.kuntz.co/> to generate a host of sites.
While the source *is* available for other people, it'll probably
take some tinkering to get it working for your own site. Sorry.
'''
#!/usr/bin/env python2
'''
Make Me (makeme): refactor
Essentially the same thing as makeme, but refactored slightly. Because.
'''
import logging
import re
package main
import (
"flag"
"fmt"
//"github.com/MaximeD/gost/conf"
//"github.com/MaximeD/gost/gist"
"./gist"
"./conf"
"os"
@sleepdeprecation
sleepdeprecation / myHandler.java
Created February 8, 2014 05:05
Java HTTPServer's new handlers
//
// Option One.
//
import httpserver.*;
public class myHandler extends HTTPHandler {
public myHandler() throws HTTPException {
addGET("/showHeaders", "showHeaders");