Skip to content

Instantly share code, notes, and snippets.

@yaph
yaph / checkboxes.js
Last active October 27, 2023 19:14
Check or uncheck all check boxes using browser JavaScript console
# JS snippet for email notification settings, e. g. Twitter
cb=document.querySelectorAll('input[type="checkbox"]');for(i in cb){cb[i].checked=false}
# for Drupal 4.x comment approval form
cbx=document.getElementsByClassName('form-checkbox');for(i in cbx){cbx[i].checked=true}
@yaph
yaph / tunnel.sh
Created December 4, 2012 23:12
aliases for creating and killing an ssh tunnel using sshuttle
# http://coding.smashingmagazine.com/2012/10/29/powerful-command-line-tools-developers/
alias tunnel='sshuttle -D --pidfile=/tmp/sshuttle.pid -r <server> --dns 0/0'
alias stoptunnel='[[ -f /tmp/sshuttle.pid ]] && kill `cat /tmp/sshuttle.pid`'
@yaph
yaph / README.md
Created May 18, 2012 22:23
Map of GitHub Commits

README

A geographic map that displays GitHub commits by countries. To view the map and information on how it was created see this article.

You can also view this gist at bl.ocks.org. If you fork it and apply changes you can see them live at bl.ocks.org/YOUR_GIST_ID.

@yaph
yaph / download-jpg.sh
Last active November 1, 2022 11:20
Extract all URLs to jpg files from text file with grep and download images with wget
grep -shoP 'https?.*?\.jpg' rss.xml | xargs wget
@yaph
yaph / citysearch.py
Created December 6, 2012 18:46 — forked from vlandham/citysearch.py
Search where people are moving in Germany
# coding: utf-8
# requires: pattern http://www.clips.ua.ac.be/pages/pattern
from pattern.web import *
import csv
import itertools
# engine = Google(license='XXX', throttle=2.0)
#engine = Twitter(license=None)
engine = Bing()
@yaph
yaph / ula2json.js
Created October 24, 2013 20:14
Convert an HTML ul list of links to a JSON list of objects with href and text content.
var list = [];
$('ul a').each(function(idx, item){
list.push({
href: $(item).attr('href'),
text: item.textContent
});
});
JSON.stringify(list, null, " ");
@yaph
yaph / cloudSettings
Last active May 31, 2021 23:09
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-31T23:09:01.158Z","extensionVersion":"v3.4.3"}
@yaph
yaph / Ubuntu_post_install.sh
Last active February 15, 2021 22:49
Ubuntu post install scripts
sudo apt-get install abiword chromium-browser gimp gftp icoutils keepassx python-gpgme ssh xclip
# drivers
sudo apt-get install brother-lpr-drivers-extra
# dev
sudo apt-get install curl git gitk htop phantomjs python-pip mysql-server r-base vim
# Apache
sudo apt-get install apache2 libapache2-mod-fcgid
@yaph
yaph / phpmyadmin file name template
Created March 8, 2011 15:40
File name template for phpMyAdmin with today's date and database name
%Y_%m_%d___DB__
@yaph
yaph / index.html
Last active October 23, 2019 21:56
d3-geomap label example for stackoverflow.com/questions/58520822
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="https://d3-geomap.github.io/d3-geomap/d3-geomap.css" rel="stylesheet">
<style>
.place-label {
fill: #000;
}
</style>