Skip to content

Instantly share code, notes, and snippets.

Avatar

Karim Ratib infojunkie

View GitHub Profile
@infojunkie
infojunkie / serverless.yml
Last active Aug 16, 2021
Upload Zoom files to AWS S3
View serverless.yml
service: labyrinth-service
provider:
name: aws
iamManagedPolicies:
- "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
@infojunkie
infojunkie / package.json
Last active Dec 4, 2020
Running specific tests using mocha from a package.json script
View package.json
"scripts": {
"test": "mocha --grep /${TEST:-'.*'}/i",
},
@infojunkie
infojunkie / .block
Last active Dec 18, 2016
VexFlow test #1
View .block
license: gpl-3.0
height: 300
@infojunkie
infojunkie / youtube-album.md
Last active Aug 24, 2021
Convert audio track/album to YouTube video
View youtube-album.md

youtube-album

A recipe to prepare audio file(s) for YouTube upload. Video will be a slideshow of images on repeat.

Requires: imagemagick ffmpeg

  1. Convert images to required size. Here I assume .png files and output to png/ folder. See http://www.imagemagick.org/Usage/crop/#extent
@infojunkie
infojunkie / midi-invert.py
Created Aug 18, 2016
MIDI keyboard inversion using music21
View midi-invert.py
#!/usr/bin/python
import sys
from music21 import *
mf = midi.MidiFile()
mf.open(sys.argv[1])
mf.read()
s = midi.translate.midiFileToStream(mf)
for n in s.flat.notes:
for p in n.pitches:
@infojunkie
infojunkie / token_theme.info
Last active Aug 29, 2015
Drupal theme tokens
View token_theme.info
name = Token Theme
description = Create tokens for theme settings.
core = 7.x
@infojunkie
infojunkie / devel_forms.info
Last active Sep 15, 2021
Debug info for Drupal forms
View devel_forms.info
name = Devel forms
description = Tools for developing and debugging Form API.
package = Development
core = 7.x
dependencies[] = devel
View gist:11232218
### Keybase proof
I hereby claim:
* I am infojunkie on github.
* I am kratib (https://keybase.io/kratib) on keybase.
* I have a public key whose fingerprint is 242A D815 51B9 39D4 7013 0F1F E814 5192 B6EA 54BC
To claim this, I am signing this object:
View demo_i18n.module
<?php
/**
* Implements hook_views_query_alter().
*/
function demo_i18n_views_query_alter(&$view, &$query) {
unset($query->relationships['node_node']);
unset($query->relationships['node_node_1']);
unset($query->relationships['node_node_2']);
unset($query->table_queue['node_node']);
@infojunkie
infojunkie / views_join_translation.module
Last active Dec 17, 2015
A Drupal Views join handler to be used with node translation relationships. This join returns translated nodes *or* the node itself if it is not translated. This is useful to guarantee that some node is returned. To understand the context: http://thereisamoduleforthat.com/content/view-nodes-and-their-translations.
View views_join_translation.module
<?php
/**
* Implements hook_views_data_alter().
*/
function views_join_translation_views_data_alter(&$data) {
$data['node']['translation']['relationship']['join_handler'] = 'views_join_translation';
}
/**