Skip to content

Instantly share code, notes, and snippets.

View joar's full-sized avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
@joar
joar / run_gevent.py
Last active December 11, 2015 01:58
Alternative GNU MediaGoblin app runners
# - Static doesn't work (set it up elsewhere or build a handler)
# - Beaker works
from gevent import wsgi
from mediagoblin.app import MediaGoblinApp
from beaker.middleware import SessionMiddleware
if __name__ == '__main__':
mg_app = MediaGoblinApp('mediagoblin_local.ini')
# encoding: utf-8
shrimp_sandwich = u'Räksmörgås'
shrimp_sandwich += '-'
print(shrimp_sandwich)
shrimp_sandwich += raw_input('What\'s shrimp sandwich in Swedish?: ')
# What's shrimp sandwich in Swedish?: Räksmörgås
# ---
# Traceback (most recent call last):
# File "/tmp/shrimp_sandwich.py", line 5, in <module>
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index bee67d4..5d7ac9a 100644
--- a/mediagoblin/config_spec.ini
+++ b/mediagoblin/config_spec.ini
@@ -86,6 +86,10 @@ max_height = integer(default=640)
max_width = integer(default=180)
max_height = integer(default=180)
+[media_type:mediagoblin.media_types.image]
+# One of BICUBIC, BILINEAR, NEAREST, ANTIALIAS

Notifications in MediaGoblin

Scenarios

Action:
Comment, favorite, added to collection

Joar posted a picture, someone performs an action on it. Joar is

@joar
joar / mediagoblin-subdirectory.nginxconf
Last active December 11, 2015 16:28
Host MediaGoblin in a subdirectory
server {
# [...]
# Your regular MediaGoblin nginx configuration settings
# [...]
# Mounting MediaGoblin via FastCGI.
location /MEDIAGOBLIN_SUBFOLDER/ {
fastcgi_pass 127.0.0.1:26543; # The address of the MediaGoblin FastCGI server
include /etc/nginx/fastcgi_params;
@joar
joar / reinstall-nvidia-kernel-module.sh
Last active December 11, 2015 16:28
My NVIDIA drivers crash every time I install a new kernel. Putting this here so that I can remember it.
sudo apt-get install linux-headers-$VERSION-generic
sudo dpkg-reconfigure nvidia-current-updates
sudo reboot
@joar
joar / gist:4642578
Last active December 11, 2015 18:38
HTTP/1.1 301 Moved Permanently
Server: nginx/1.2.1
Date: Sat, 26 Jan 2013 14:09:26 GMT
Content-Type: text/html
Content-Length: 184
Location: http://vm1-joar.pagekite.me/m/
Connection: keep-alive
*** ../transcoders.py 2013-02-07 22:02:20.000000000 +0100
--- mediagoblin/media_types/video/transcoders.py 2013-02-07 22:02:30.000000000 +0100
***************
*** 367,373 ****
self.width = width
self.height = height
- print self.height, self.width
self.position_callback = position_callback \
or self.wadsworth_position_callback
@joar
joar / index.html
Last active December 12, 2015 08:49
<!DOCTYPE html>
<html lang="en">
<body>
<div id="chart">
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://d3js.org/d3.v3.js"></script>
<script>
var raw_series = [{"note": "TEXAS LONGHORN", "date": "2013-01-10T00:00:00", "amount": 110.0, "id": 74, "account_id": 1}, {"note": "GOOGLE *FEO Medi", "date": "2013-01-10T00:00:00", "amount": 22.0, "id": 73, "account_id": 1}, {"note": "Pressbyran 5122", "date": "2013-01-10T00:00:00", "amount": 13.0, "id": 77, "account_id": 1}, {"note": "ICA SUPERMARKET", "date": "2013-01-10T00:00:00", "amount": 106.0, "id": 76, "account_id": 1}, {"note": "H\u00c5R 3000", "date": "2013-01-10T00:00:00", "amount": 345.0, "id": 75, "account_id": 1}, {"note": "Pressbyran 5122", "date": "2013-01-11T00:00:00", "amount": 19.0, "id": 72, "account_id": 1}, {"note": "BIRKA PUNKTEN", "date": "2013-01-11T00:00:00", "amount": 79.0, "id": 71, "account_id": 1}, {"note": "DROPBOX", "date": "2013-01-11T0
@joar
joar / discover.py
Created February 11, 2013 21:36
Discover a media file using python-gst0.10, excerpt from interactive session
# coding: utf-8
import gst
from gst.pbutils import Discoverer
d = Discoverer(50000000000)
r = d.discover_uri('file:///home/joar/Downloads/MVI_4364.AVI')
r.get_duration() / gst.SECOND
r.get_seekable()
r.get_result()