Skip to content

Instantly share code, notes, and snippets.

@abubelinha
abubelinha / README.md
Last active August 29, 2015 14:00 — forked from mbostock/.block
Zoomable Circle Packing
@abubelinha
abubelinha / gist:0c797f93a7fccf1896f36d4020f09fd6
Last active December 17, 2017 00:11 — forked from mhawksey/gist:5599539
Experiment to create a document map for Google Docs using Google Apps Script
/* https://docs.google.com/document/d/1r68eiN0w_NGGjloTD2RL_91opnPfAfHR81MQloKVvTo/edit#heading=h.g9i813j0d54t
From https://mashe.hawksey.info/2013/05/playing-with-google-docs-sidebar-using-google-apps-script/
https://developers.google.com/apps-script/reference/document/table-of-contents
https://developers.google.com/apps-script/reference/document/body#getHeadingAttributes(ParagraphHeading)
https://opensourcehacker.com/2013/01/21/script-for-generating-google-documents-from-google-spreadsheet-data-source/
https://www.quora.com/How-do-I-find-and-replace-formatting-in-Google-Docs
*/
function onOpen() {
// Add a menu with some items, some separators, and a sub-menu.
@abubelinha
abubelinha / psql-with-gzip-cheatsheet.sh
Created May 1, 2018 12:11 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@abubelinha
abubelinha / ffmpeg.md
Created March 24, 2019 20:28 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@abubelinha
abubelinha / .block
Last active April 3, 2020 22:56
index.html/js bl.ocks example
license: gpl-3.0
height: 500
scrolling: no
border: yes
@abubelinha
abubelinha / .treehouse
Last active April 5, 2020 18:36 — forked from ErikGartner/.treehouse
dTree Demo
1.3.1
@abubelinha
abubelinha / index.html
Created April 6, 2020 09:49 — forked from rengel-de/index.html
Timeline for d3 - proof-of-concept
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" lang="de" content="Zeitleiste, Zeitlinie, Zeitkarte, Geschichte, Chronologie">
<meta name="keywords" lang="en" content="Timeline, Timemap, History, Chronology">
<title>Timeline - Proof-of-concept</title>
<!-- That's my local d3 path. When working locally, use your local path. -->
@abubelinha
abubelinha / d3.slider.css
Created April 6, 2020 09:50 — forked from cmdoptesc/d3.slider.css
D3: Map Timeline
.d3-slider {
position: relative;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
border: 1px solid #aaaaaa;
z-index: 2;
}
.d3-slider-horizontal {
height: .8em;
@abubelinha
abubelinha / so_read_url_write_file.py
Created January 19, 2021 22:06 — forked from hughdbrown/so_read_url_write_file.py
Read from URL, write to file
"""
Code to write data read from a URL to a file
Based on an answer on SO:
http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python/22721
"""
import urllib2
mp3file = urllib2.urlopen("http://www.example.com/songs/mp3.mp3")
@abubelinha
abubelinha / bench.py
Created January 23, 2021 17:48 — forked from methane/bench.py
Benchmarking MySQL drivers (Python 3.4)
from __future__ import print_function
import time
def query_10k(cur):
t = time.time()
for _ in range(10000):
cur.execute("SELECT 1,2,3,4,5")
res = cur.fetchall()
assert len(res) == 1
assert res[0] == (1,2,3,4,5)