This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Script to rename and organise recordings on Topfield TRF 7160 | |
Names everything '<programme> <date> <time>' | |
If there are more than two recordings of a programme it creates | |
a folder for it and moves everything into it. If the folder was | |
already created all recordings will be moved" | |
Requires the FTP service to be running on the topfield. | |
Usage: python tf_organise.py <ip_address> <username> | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
This script will archive a directory and leave a text file | |
in its place with info about the files that have been removed. Allows you to | |
be fairly ruthless in your cleanup safe in the knowledge you can get it back later | |
if required. For example: | |
python archive.py data/projects/old_project -a data/archive | |
will result in two files, the old_projects directory will be deleted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
SLEEP_ENABLED=30 # change this if you want (>14) | |
SLEEP_DISABLED=14 | |
POWER_CONFIG="xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-on-ac" | |
case "$1" in | |
true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseX { | |
/** RFC4648 Base62 */ | |
const BASE_64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | |
/** RFC4648 "URL and Filename safe" Base64 */ | |
const URL_64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; | |
/** URL and filename safe Base64 in UCA order */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Javascript protobuf implementation | |
* Not compatible with official implemementation as no binary data in JS | |
* Not very useful as only compacts around 50% depending on fields | |
* Might be a good basis for something else one day though... | |
*/ | |
var VarInt32 = { | |
'_base64': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", | |
'encode': function(i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compact objects before serializing | |
* Reduces serialized size by around 40% depending on field types | |
* Takes an object describing the fields to compact/expand | |
* fields can be added/removed as long as the number stays the same | |
* | |
* var person = { 'name': 1, 'age': 4, 'town': 5 }; | |
* var bob = { 'name': 'Bob', 'age', 42, 'town': 'London' }; | |
* var data = JSON.stringify(Squirrel.compact(bob, person)); | |
* console.log(Squirrel.expand(JSON.parse(data), person)); |