Skip to content

Instantly share code, notes, and snippets.

@riyad
riyad / email_from_imap.py
Created May 27, 2020
Scaffolding for fetching and parsing emails from IMAP
View email_from_imap.py
#!/usr/bin/python3
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Scaffolding for fetching and parsing emails from IMAP
import imaplib
import email.parser
import email.policy
@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
@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
View cleanup_redis_uniquejobs.rb
#!/usr/bin/env ruby
#
# Cleanup Sidekiq uniquejobs in Redis
# see https://github.com/mhenrixon/sidekiq-unique-jobs/issues/195
#
require 'bundler/setup'
require 'sidekiq/api'
DRY_RUN = true
@riyad
riyad / extract-audio.sh
Last active Nov 17, 2018
Extract audio from any media file ffmpeg can play into a new one (without converting or reencoding!)
View extract-audio.sh
#!/bin/sh
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Extract audio from any file ffmpeg can play (without converting or reencoding!).
if [[ $# -ne 3 ]]; then
echo "Error: wrong number of arguments"
@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 / another-intermediate-ca_csr.json
Last active Nov 17, 2018
Using CFSSL building your own CA and generating service specific key, cert and chain files.
View another-intermediate-ca_csr.json
{
"CN": "Another Intermediate CA",
"hosts": [
""
],
"key": {
"algo": "ecdsa",
"size": 384
},
"names": [
@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 / 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())
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)
You can’t perform that action at this time.