Skip to content

Instantly share code, notes, and snippets.

View infojunkie's full-sized avatar
💭
🎶

Karim Ratib infojunkie

💭
🎶
View GitHub Profile
@infojunkie
infojunkie / wc-pdf.sh
Created December 14, 2021 22:52
Count words in a list of PDF files
#!/bin/bash
find "$@" -name '*.pdf' | while read f; do pdftotext "$f" - | wc -w; done | paste -sd+ | bc
@infojunkie
infojunkie / serverless.yml
Last active August 16, 2021 06:48
Upload Zoom files to AWS S3
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 December 4, 2020 01:20
Running specific tests using mocha from a package.json script
"scripts": {
"test": "mocha --grep /${TEST:-'.*'}/i",
},
@infojunkie
infojunkie / .block
Last active December 18, 2016 00:14
VexFlow test #1
license: gpl-3.0
height: 300
@infojunkie
infojunkie / youtube-album.md
Last active August 24, 2021 04:26
Convert audio track/album to YouTube video

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 August 18, 2016 00:03
MIDI keyboard inversion using music21
#!/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 August 29, 2015 14:24
Drupal theme tokens
name = Token Theme
description = Create tokens for theme settings.
core = 7.x
@infojunkie
infojunkie / devel_forms.info
Last active September 15, 2021 01:41
Debug info for Drupal forms
name = Devel forms
description = Tools for developing and debugging Form API.
package = Development
core = 7.x
dependencies[] = devel
@infojunkie
infojunkie / gist:11232218
Created April 23, 2014 21:00
keybase.md
### 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:
<?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']);