Create and enter a working directory
mkdir -p ~/dnscrypt-working-directory && cd ~/dnscrypt-working-directoryBecome root
sudo -s| // ActiveTable - a bookmarklet to make tables sortable and editable | |
| function init() { | |
| var aHrows = getHrows(); | |
| var numHrows = aHrows.length; | |
| var aHidden = getHiddenColumns(); | |
| ATpopup = document.createElement("div"); | |
| ATpopup.style.cssText = "position: absolute; visibility: hidden; padding: 0; font-family: Arial; background-color: rgba(255, 255, 255, 0.9); border-radius: .5em; text-align: center; box-shadow: .05em .05em .5em #00C;"; | |
| ATpopup.innerHTML = "<a href='sort' title='sort' onclick='sortColumn(); return false'><img border=0 src='http://stevesouders.com/images/sort_up_down.png' style='padding-top: 0.2em;'></a><br><a href='hide' style='color: #C00; font-family: monospace; font-size: 1.5em; text-decoration: none;' title='hide' onclick='hideColumn(); return false'>x</a>"; // TODO - use protocol-less URL for img |
| javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading…</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/5834741/raw/grablinks.js?x="+(Math.random());})(); |
| <?php | |
| /** | |
| * Ranking Library | |
| * contains alogrithms for story ranking | |
| * Basically a PHP Implementation of reddits algorithms | |
| * | |
| * @author Lucas Nolte <[email protected]> | |
| * @since 0.1 | |
| * @package Polska Wiadomosc | |
| * @subpackage Libraries |
| #!/usr/bin/env php | |
| <?php | |
| # From: http://www.reddit.com/r/dailyprogrammer/comments/1ml669/091713_challenge_138_easy_repulsionforce/ | |
| function calculate_repulsion_force($mass1, $mass2, $distance) { | |
| $divisor = bcmul($mass1, $mass2); | |
| $dividend = bcpow($distance, 2); | |
| return bcdiv($divisor, $dividend); | |
| } |
| #!/bin/sh | |
| # Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
| # CREATE block and create them in separate commands _after_ all the INSERTs. | |
| # Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
| # The mysqldump file is traversed only once. | |
| # Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
| # Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
| /*http://www.phpied.com/reactivetable-bookmarklet/*/ | |
| (function(){ | |
| var styles = | |
| '#reactive-table-overlay {\ | |
| background: rgba(0, 0, 0, 0.7);\ | |
| position: fixed;\ | |
| width: 100%;\ | |
| height: 100%;\ | |
| top: 0;\ | |
| left: 0;\ |
Create and enter a working directory
mkdir -p ~/dnscrypt-working-directory && cd ~/dnscrypt-working-directoryBecome root
sudo -s| // I don't always read my Comcast webmail, but when I do, I do it without ads 8-) | |
| /web.mail.comcast\.net/i.test(location.hostname) && | |
| (function () { | |
| var selectors = [ | |
| '#table_adsrvc', | |
| '#comcast-adsrvc', | |
| '#comcast-skyscrapperad', | |
| 'iframe[title=Advertisement]', | |
| '#skin_td_tree_bottom_ad', |
Here's the use case:
I have an exported website that has images deeply nested throughout it in various folders. I want to find all of them, and copy them into a single directory. I don't care about the filenames so for the sake of both dedupliacting the results and making sure no filename collisions occur, I want to name the resulting images $(sha1sum $image).jpg.
So I wrote a small script to do this and I felt like sharing:
shopt -s globstar # Enable `**` for globbing
shopt -s extglob # Enable extended glob matching
shopt -s nocaseglob # Enable case-insensitive globbing| #!/usr/bin/env python2 | |
| # -*- coding: iso-8859-1 | |
| # iPod shuffle Database Builder | |
| # ============================= | |
| # @usage Copy rebuild_db.py to your iPod's root directory and run it. | |
| # @url http://shuffle-db.sourceforge.net | |
| # @author Martin J. Fiedler <[email protected]> | |
| # @license GPL 2 <http://www.gnu.org/licenses/gpl-2.0.html> |