Skip to content

Instantly share code, notes, and snippets.

Riyad Preukschas riyad

Block or report user

Report or block riyad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bottle_plugin_lifecycle_tester.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
@riyad
riyad / provoke_rabbitmq_queue_crash_with_deadlettering.py
Last active Aug 29, 2015
Provoke RabbitMQ Queue Crash With Deadlettering (Issue #216)
View provoke_rabbitmq_queue_crash_with_deadlettering.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import logging
import puka
logger = logging.getLogger("provoke_rabbitmq_queue_crash_with_deadlettering")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
@riyad
riyad / Gemfile
Created Feb 23, 2011
How to setup your Rails app for using the declarative_authorization gem
View Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.3'
...
gem 'declarative_authorization'
group :development do
# for the graphical overview over your rules
# available at /authorization_rules
View gitlab_config_changer.sh
#!/bin/bash
for f in `grep -rl Gitlab.config app config features lib spec`
do
for c in `cat gitlab_config_keys.list`
do
mv $f $f.bak
perl -pe $c $f.bak > $f
rm -f $f.bak
done
@riyad
riyad / README.md
Last active Apr 6, 2017
a helper for creating list of 'HH:MM' for the `at` option of `Clockwork.every` with alignment and hour ranges
View README.md

Use this in your clock.rb file:

require 'clockwork'

include ClockHelper

module Clockwork
  # ...
  every 1.day, "do_something", at: steps(every: 3.hours, aligned_at: '01:32') do
@riyad
riyad / application_helper.rb
Created May 23, 2012
Render Rails assets to string
View application_helper.rb
module ApplicationHelper
# thanks to http://blog.phusion.nl/2011/08/14/rendering-rails-3-1-assets-to-string/
# you may need to change the owner of the tmp/cache/* directories to the web servers user
# e.g. for Debian systems: `chown -R www-data:www-data tmp/cache/*`
def render_asset(asset)
Conferator::Application.assets.find_asset(asset).body.html_safe
end
end
@riyad
riyad / flot-sparklines-demo.html
Last active Apr 25, 2017
flot-sparklines element for Polymer (with Demo)
View flot-sparklines-demo.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<title>Flot Sparklines for Polymer</title>
<link rel="stylesheet" href="bower_components/semantic-ui/dist/semantic.min.css">
@riyad
riyad / Application.mk
Last active Oct 6, 2017
Build Rsync for Android with Android NDK
View Application.mk
APP_ABI := armeabi-v7a
APP_OPTIM := release
APP_BUILD_SCRIPT := $(NDK_PROJECT_PATH)/Android.mk
APP_PLATFORM := android-24
#APP_PIE := true # automatically true for API level 21 and above
@riyad
riyad / ffmpeg-mp3-converter.rb
Last active Nov 17, 2018
Small scripts to transcode any file VLC or ffmpeg can play to mp3.
View ffmpeg-mp3-converter.rb
#!/usr/bin/env ruby -rubygems
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Transcode any file ffmpeg can play to mp3.
require 'optparse'
require 'shellwords'
@riyad
riyad / ffmpeg-cut
Last active Nov 17, 2018
Cut out a part of a media file within the given time stamps (without converting or reencoding!)
View ffmpeg-cut
#!/bin/bash
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Cuts out a part of a media file within the given time stamps (without converting or reencoding!).
set -o nounset # complain when reading unset vars
# set -o xtrace # print every command as it's executed
You can’t perform that action at this time.