Skip to content

Instantly share code, notes, and snippets.

View MartijnBraam's full-sized avatar

Martijn Braam MartijnBraam

View GitHub Profile
syntax on
set expandtab
set shiftwidth=4
set softtabstop=4
filetype plugin indent on
#!/bin/bash
convert $1 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 24x24 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
favicon.ico
@MartijnBraam
MartijnBraam / whiteboard.sh
Last active August 13, 2022 17:37
Whiteboard photo to svg script
#!/bin/bash
echo "Running edge detection with imagemagick..."
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "/tmp/whiteboard.png"
echo "Scaling down to 1800px max"
convert /tmp/whiteboard.png -resize 1800x1800 /tmp/whiteboard2.png
echo "Force colors to primaries with imagemagick"
convert /tmp/whiteboard2.png -separate -threshold 50% -combine /tmp/whiteboard3.png
echo "Converting to svg with autotrace..."
autotrace -color-count 4 -output-format svg -despeckle-level 1 -remove-adjacent-corners /tmp/whiteboard3.png > $2.svg
echo "Cleaning up..."
#!/bin/bash
host $1
IP=$(host -t A $1 | awk '{ print $NF }')
PTR=$(host $IP | awk '{ print $NF }')
echo "$1 is hosted on $PTR"
@MartijnBraam
MartijnBraam / schedule.py
Last active August 29, 2015 14:06
Convert the drupalcon 2014 "My schedule" page to ical format
#!/usr/bin/env python3
import re, datetime, sys
# Clone https://gist.github.com/MartijnBraam/04dd7039ad5fddcb02a6
# Save your page schedule page to current directory as schedule.html
# ./schedule.py < schedule.html > schedule.ical
#
# Or use curl:
# curl -o - https://amsterdam2014.drupal.org/user/YOUR-USER-ID/schedule | ./schedule.py > schedule.ical
@MartijnBraam
MartijnBraam / drupal.org.css
Created September 24, 2014 13:37
Drupal stylesheet override
#aside .block {
border: 1px solid #CCC;
border-radius: 4px;
box-shadow: 1px 2px 6px 0 rgba(0,0,0,0.15);
margin-bottom: 22px;
}
#dreditor-clone-button {
background: white;
border: 0px solid white;
@MartijnBraam
MartijnBraam / content-type-documentation.py
Created September 9, 2015 09:36
Generate content documentation using drush_entity
#!/usr/bin/env python3
"""
Use with: https://www.drupal.org/project/drush_entity
For example::
$ drush entity-type-read --format=json --include-fieldapi | content-type-documentation.py > documentation.md
"""
@MartijnBraam
MartijnBraam / blink.c
Created November 27, 2015 09:25
blink help
@MartijnBraam
MartijnBraam / example.php
Created December 4, 2015 23:04
Basic html element oop example
<?php
interface renderable {
function render();
}
abstract class Html implements renderable{
protected $name;
protected $attributes = [];
global: {}
---
package:
name:
- aiccu
- arduino
- arduino-mk
- bmon
- cpuburn
- curl