Skip to content

Instantly share code, notes, and snippets.

View ameliaikeda's full-sized avatar
💜
probably drinking tea

Amelia Wylie ameliaikeda

💜
probably drinking tea
View GitHub Profile
server {
listen 80;
server_name localhost marcin.dkun.us; # aliases
root /path/to/laravel/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# osu!web
server {
listen 80;
server_name beta.osu.hiroto.eu chi.ppy.sh;
error_log /home/hiroto/Dropbox/logs/osu/error-laravel.log;
root /home/hiroto/Dropbox/osu-laravel/public;
index index.php index.html;
@ameliaikeda
ameliaikeda / AjaxTrait.php
Created January 15, 2014 19:25
Laravel AJAX trait addition for HTML5 History navigation
<?php
trait AjaxTrait {
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout() {
09:31:26 (laravel)~! ~/Dropbox/osu-laravel
(hiroto~dev)$ php --version
PHP 5.5.7-1~dotdeb.1 (cli) (built: Dec 14 2013 21:40:10)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
@ameliaikeda
ameliaikeda / dumper.py
Last active January 2, 2016 13:39
R/a/dio database dumper (for songs).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from mutagen.easyid3 import EasyID3
from mutagen.id3 import ID3
import MySQLdb
import MySQLdb.cursors
import shutil
import os
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="yes" method="xml" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<pre>
<xsl:for-each select="source">
<xsl:value-of select="artist" /> - <xsl:value-of select="title" />
</xsl:for-each>
</pre>
</xsl:template>
</xsl:stylesheet>
#!/usr/bin/env python
# -*- coding: utf8 -*-
import urllib
from time import sleep
meta = open("/Users/hiroto/metadata", "r+")
prev_song = False
while True:
@ameliaikeda
ameliaikeda / hl.py
Created March 17, 2013 15:31
Hexchat highlights script
# Hiroto's HL script.
__module_name__ = "PyHighlights"
__module_version__ = "v0.1"
__module_description__ = "Script to shove highlights into another window."
import urllib2
import urllib
import xchat
context = xchat.get_context()
xchat.command("QUERY highlights")
@ameliaikeda
ameliaikeda / sorter.py
Created March 14, 2013 15:58
I was given an hour to mass-rename 100k files in various folders. challenge accepted. (and the script took 5 minutes)
import os
import MySQLdb
import re
class ImageSorter(object):
def __init__(self, base_directory):
self.cur = MySQLdb.connect(host='127.0.0.1', user="root", db="magento").cursor() # come at me
self.skus = {}
self.directory = base_directory
Use of the `mysql_*` functions in PHP is discouraged in favour of [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli)  ([find out why](http://stackoverflow.com/questions/12859942))

Use of the mysql_* functions in PHP is discouraged in favour of PDO or MySQLi (find out why)