Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Installs tarsnap client on Debian and Ubuntu
#
# You'll need to setup an account at
# http://www.tarsnap.com
# and load it with some funds
#
# Make sure you run this as root
#
root@1ab2badf98de:/hibiscus-server/cfg# /hibiscus-server/jameicaserver.sh -p 234234234234234234 -f /srv/hibiscus2
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] starting in SERVER mode
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] workdir: /srv/hibiscus2
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] master password given via commandline
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.Application.init] starting jameica...
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.Platform.getWorkdir] using workdir: /srv/hibiscus2
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.services.SecurityManagerService.init] applying jameica security manager
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.security.JameicaSecurityManager.<init>] protecting program dir /hibiscus-server/
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.services.LockService.init] creati
@miracle2k
miracle2k / ass_parser.js
Created July 18, 2014 08:33
Old code, trying to parse ASS files.
// https://github.com/Arnavion/libjass
// https://github.com/spiegeleixxl/html5-ass-subtitles/blob/master/assparser.js
Subtitles = {};
Subtitles.ASS = function(content) {
var linesOfDialog = [];
@miracle2k
miracle2k / gist:21a6ed83b05af6c3e608
Created December 29, 2014 01:07
Upload to imgur from your headless server
#!/bin/bash
# https://github.com/Ceryn/img
# Call with '-s' to target only a selection of the screen.
clientid='3e7a4deb7ac67da'
img=$1
res=$(curl -sH "Authorization: Client-ID $clientid" -F "image=@$img" "https://api.imgur.com/3/upload")
echo $res
echo $res | grep -qo '"status":200' && link=$(echo $res | sed -e 's/.*"link":"\([^"]*\).*/\1/' -e 's/\\//g')
@miracle2k
miracle2k / gist:7105912ca21028f64e52
Last active August 29, 2015 14:13
Automagic __repr__ for SQLAlchemy entities with primary key columns with Declarative Base.
# Adapted from http://foobar.lu/wp/2013/07/05/automagic-__repr__-for-sqlalchemy-entities-with-primary-key-columns-with-declarative-base/
class RepresentableBase(object):
"""
This class can be used by ``declarative_base``, to add an automatic
``__repr__`` method to *all* subclasses of ``Base``. This ``__repr__`` will
represent values as::
ClassName(pkey_1=value_1, pkey_2=value_2, ..., pkey_n=value_n)
// Modify contrast using a ColorMatrix (on Android)
ColorMatrixColorFilter setContrast(float contrast) {
float scale = contrast + 1.f;
float translate = (-.5f * scale + .5f) * 255.f;
float[] array = new float[] {
scale, 0, 0, 0, translate,
0, scale, 0, 0, translate,
0, 0, scale, 0, translate,
0, 0, 0, 1, 0};
ColorMatrix matrix = new ColorMatrix(array);
class ColorDict(object):
"""Provides a color for each key, trying to create as distinct a set
of colors as possible.
"""
# Minimum difference in hue between unique colors, before we begin
# to recycle old colors rather than generating new ones.
THRESHOLD = 0.05
def __init__(self):
"scripts": {
"build-js": "react-native bundle --url 'lib/index.ios.bundle?platform=ios&dev=' --minify && mv ios/main.jsbundle ios/project && git update-index --assume-unchanged ios/project/main.jsbundle",
},
@miracle2k
miracle2k / gist:d4a28ea02279fa47e532
Created September 29, 2015 06:55
What RelayQL strings look like after going through the generator.
var GraphQL = Relay.QL.__GraphQL;
return new GraphQL.QueryFragment(
'Builder', 'AddMenuItemPayload',
[new GraphQL.Field('node', null, null, null, null, null, {parentType: 'AddMenuItemPayload'}),
new GraphQL.Field('client', [
new GraphQL.Field('menuitems', [
new GraphQL.Field('count', null, null, null, null, null, {parentType: 'MenuItemConnection'})],
null,
[new GraphQL.Callv('first', new GraphQL.CallVariable('format'))],
null, null, {parentType: 'Client', connection: true, nonFindable: true}),
@miracle2k
miracle2k / README
Created January 14, 2012 20:14
Optional variations in CSS
The idea is two provide optional variations for your stylesheet, for
presentation purposes, and have a switcher built into the page to
enable/disable them.
Usage - include the Javascript code in your page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="cssoptions.js"></script>
Note that jQuery >= 1.7 is required.