This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# cd into the folder of mp3s, have a cover.jpg fileready inside it. | |
eyeD3 --to-v2.4 ./*.mp3; eyeD3 --remove-images ./*.mp3; eyeD3 --add-image=cover.jpg:FRONT_COVER ./*.mp3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Solution to installation error for Angry Birds 1.1.2 using Wine | |
# http://www.angrybirdsnest.com/angry-birds-star-wars-escape-from-hoth-update-out-now/#comment-497306 | |
# | |
# Basically, we extract the contents of the installer to a temporary directory (C:\angrybirds112) | |
# , and then start the installer manually (setup.msi) | |
# First, install the package which enables the images in the installer, just because. | |
sudo apt-get install libjpeg62 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ex: Google Web Inspector: "Copy XPath...", this returns that XPath it back to a node | |
var xPathToNode = function( xpath ) { | |
return (document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)).singleNodeValue; | |
} | |
// Example w jQuery | |
console.log( $( xPathToNode('/html/body/div[2]/dl[11]/dt') ).text() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This strips the color profile of an image (ie making it sRGB built-in) | |
# install the dep. first = apt-get install liblcms-utils | |
while [ $# -gt 0 ]; do | |
picture=$1 | |
file_mime_error=0 | |
convert_error=0 | |
FILE_MIME=$(file -b "$picture") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# node and python method for urlencoding and urldecoding | |
# insert into your alias list | |
alias urlencode_py='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' | |
alias urldecode_py='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' | |
alias urlencode_js='node -e "console.log(encodeURIComponent(process.argv[1]))"' | |
alias urldecode_js='node -e "console.log(decodeURIComponent(process.argv[1]))"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGE=/path/to/image | |
if [[ "$(file -b $IMAGE)" =~ ^JPEG ]]; then | |
# EX: JPEG image data, JFIF standard 1.01 | |
echo "Valid JPEG image" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage in bash/sh | |
// $ NODERESULT=`node worker.js $(echo -n "Variable / file content" | base64 -w 0)` | |
// encode variable in bash and decode it in node using atob package | |
// , and finally decode the result in bash. | |
// $ NODERESULT=$(echo -n "$NODERESULT" | base64 --decode -w 0) | |
// This makes every argument given to node foolproof. | |
if ( !process.argv[2] ) { | |
throw new Error( "No valid argument given!" ); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you edit your tools, "Manage external tools", wrap your code in brackets and send it to /dev/null | |
#!/bin/bash | |
{ | |
#some code | |
} &>/dev/null | |
# this way you can suppress warnings otherwise sent to the console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Selects all matching elements who's first letter is 'x' | |
// Ignores any leading whitespace. | |
// | |
// Usage: | |
// <p>Hello!</p> | |
// <p>Honestly...</p> | |
// <p>Goodbye!</p> | |
// | |
// var allHes = $("p:startswith('h')"); // == [ "<p>Hello!</p>", "<p>Honestly...</p>" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This replaces the included jQuery file from WP and uses the cdn hosted version from Google | |
// PLUS removes the ?ver=1.x.x from the url, making it more likely to be cached already | |
function rssv_scripts() { | |
global $wp_scripts; | |
if ( !is_a( $wp_scripts, 'WP_Scripts' ) ) | |
return; | |
$wp_scripts->registered[jquery]->ver = null; |