Skip to content

Instantly share code, notes, and snippets.

View frederikbrudy's full-sized avatar

Frederik frederikbrudy

View GitHub Profile

Bionic Reader Bookmarklet

This bookmarklet is inspired by Bionic Reader API that is truly incredible. However I have issues with service APIs that are not clear on how they handle the privacy and security of my data. So I made a quick and dirty bookmarklet to do the job locally.

  • Create a new bookmark in your browser
  • Use this script as the address:
javascript:(function(){!function(){window.hasOwnProperty("bionicWordWrapApplied")||(!function(e){var n,t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,null);for(;n=t.nextNode();){for(var o,r=n.parentNode,d=n.nodeValue;o=d.match(/^(\s*)(\S+)/);){d=d.slice(o[0].length),r.insertBefore(document.createTextNode(o[1]),n);var a=Math.ceil(o[2].length/2),c=r.insertBefore(document.createElement("b"),n);c.appendChild(document.createTextNode(o[2].slice(0,a)));var i=r.insertBefore(document.createElement("span"),n);i.appendChild(document.createTextNode(o[2].slice(a)))}n.nodeValue=d}}(document.body),window.bionicWordWrapApplied=!0
@liangfu
liangfu / ffmpeg.md
Created May 24, 2017 04:46 — 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:

@bastianallgeier
bastianallgeier / radius.php
Last active April 19, 2020 18:09
Radius search
<?php
/**
* Simple helper to fetch the bounding boxes
* for a point on the map (lat,lng) by radius.
*
* @param double $lat Latitude
* @param double $lng Longitude
* @param int $radius Radius in km
* @return array
@bastianallgeier
bastianallgeier / nginx
Last active November 30, 2023 10:14
nginx setup
# block content
location ~ ^/content/(.*).(txt|md|mdown)$ {
rewrite ^/content/(.*).(txt|md|mdown)$ /error redirect;
}
# block all files in the site folder from being accessed directly
location ~ ^/site/(.*)$ {
rewrite ^/site/(.*)$ /error redirect;
}
@walkerjeffd
walkerjeffd / Synology-Diskstation-Git.md
Last active April 27, 2024 15:39
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@mariussturm
mariussturm / gist:061b9f4861ef1292aa60
Last active February 1, 2017 13:16
How to pair Firefox 29 with Owncloud's mozilla_sync / Weave
_Go to your Owncloud installation <https://myowncloud/remote.php/mozilla_sync> and accept the SSL Certificate
_Open about:config
_Create: services.sync.username <string> the value should be a hash not the username itself. (You only need the hash if the
sync was setup with a pre FF29, if you start from scratch the string doesn't matter)
You can look this up in an older browser or in the logs of your Owncloud server!!
_Go to: Preferences -> Sync -> Setup Firefox sync (you should see the old UI now)
'I Have an Account'
'I don't have the device with me'
'Account' - again use the hash NOT the actual username!
@tsileo
tsileo / duptools.sh
Created July 19, 2012 22:08
A bash script to simplify backup management with duplicity (encrypted incremental backups on amazon S3)
#!/bin/bash
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
export PASSPHRASE=YOU_PASSHRASE
# directories, space separated
SOURCE="/home/thomas/backup /home/thomas/bin /home/thomas/documents"
BUCKET=s3+http://mybucket
LOGFILE=/home/thomas/tmp/duplicity.log
# set email to receive a backup report
@oodavid
oodavid / README.md
Created March 26, 2012 21:21
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@jimlindstrom
jimlindstrom / plot-likert.r
Created November 30, 2011 03:36
Plotting Likert-scale data with R
# Inputs
feature_names <- c("Feature 5", "Feature 4", "Feature 3", "Feature 2", "Feature 1")
num_features <- length(feature_names)
y <- array(c(10,4,1,0, 3,4,2,0, 1,2,8,1, 0,0,5,1, 1,2,5,3), dim=c(4,num_features))
# Calculate plot
num_neg_ratings <- 0
num_pos_ratings <- 0
for(i in 1:num_features) {
num_neg_ratings = max(num_neg_ratings, sum(y[1:2,i]), sum(y[3:4,i]))