Skip to content

Instantly share code, notes, and snippets.

@pbuyle
pbuyle / authorized_key
Last active December 28, 2015 08:29
Drush only SSH access using a dedicated key.
command="/etc/drush/drush-shell" ssh-rsa AAAA...== drush
@pbuyle
pbuyle / branches.groovy
Last active October 8, 2018 14:50
Groovy script to get a list of Git branches for a GitLab managed repository, usable with Jenkins Extensible Choice plugin.
project_id = 1
private_token = "XXXXXXXXXXXXXXXXXXXX"
return new groovy.json.JsonSlurper().parseText(new URL("https://git.pheromone.ca/api/v3/projects/"+project_id+"/repository/branches?private_token="+private_token).text).name
@pbuyle
pbuyle / fun_with.module
Created October 15, 2012 17:56
Fun with entity_view
function fun_with_entity_view($entity, $entity_type, $view_mode, $langcode) {
list($entity_id) = entity_extract_ids($entity_type, $entity);
if ($view_mode === 'full') {
$entity->content['teaser'] = entity_view(entity_load($entity_type, $entity_id), $entity_type, 'teaser', $langcode);
}
}
<?php
/**
* Implements hook_field_info().
*/
function MODULE_field_info() {
return array(
'video_thumbnail_settings' => array(
'label' => t('Video Thumbnail Settings'),
'description' => t('Configure Video Thumbnail display.'),
'settings' => array(),
@pbuyle
pbuyle / gstTest.py
Created January 5, 2009 20:49
Play an audio file on a TuxDroid with GStreamer
#! /usr/bin/python
from tuxisalive.api.TuxAPI import *
import pygst
pygst.require("0.10")
import gst
import gtk
__author__="pbuyle"
__date__ ="$05-janv.-2009 21:21:57$"
@pbuyle
pbuyle / tuxgtk.py
Created January 3, 2009 21:06
Using the GTK loop to block a Tux Droid script until the K_STANDBY button is pressed (with a bonus status icon)
#! /usr/bin/python
from tuxisalive.api.TuxAPI import *
import gtk
tux = TuxAPI('127.0.0.1', 270)
tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'TuxGTK', 'NONE')
tux.server.waitConnected(10.0)
tux.dongle.waitConnected(10.0)
tux.radio.waitConnected(10.0)
if tux.access.waitAcquire(10.0, ACCESS_PRIORITY_NORMAL):
@pbuyle
pbuyle / gist:42700
Created January 2, 2009 21:17
Simple script to control VLC (or any MPRIS media player) with the Tux Droid's remote control (http://www.kysoh.com/tux-droid)
#!/usr/bin/python
# -*- coding: UTF8 -*-
import dbus
from tuxisalive.api.TuxAPIConst import *
from tuxisalive.api.TuxAPI import TuxAPI
__author__ = 'mongolito404@gmail.com'
__appname__ = 'TuxVlcControl'
__version__ = '0.0.1'
__date__ = '2008/12/29'
from tuxisalive.api import *
def start_spin(*args):
key = args[0]
if(key == K_LEFT):
tux.spinning.leftOnAsync(1.0, SPV_SLOW)
else:
tux.spinning.rightOnAsync(1.0, SPV_SLOW)
tux = TuxAPI('127.0.0.1', 270)
CmdUtils.CreateCommand({
name: "tux-say",
icon: "http://tuxisalive.com/favicon.ico",
homepage: "http://www.tuxisalive.com/tux-droid-forum/scripts/673765359",
author: { name: "mongolito404", email: "mongolito404@gmail.com"},
license: "GPL",
description: "Read a text with your Tux Droid.",
help: "tux-say Hello World",
takes: {"input": noun_arb_text},
execute: function(msg) {