Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
@Lewiscowles1986
Lewiscowles1986 / benchmark-url-csv
Created February 13, 2018 12:45
Benchmark URL endpoint CSV
#!/bin/bash
if [[ $# -lt 1 ]];
then echo "You need to pass a url!"
echo "Usage:"
echo "$0 {url}"
exit
fi
URL=$1
@Lewiscowles1986
Lewiscowles1986 / SPARQL
Created February 1, 2018 16:06
SPARQL on RDF
PREFIX vCard: <http://www.w3.org/2001/vcard-rdf/3.0#>
SELECT ?lastName ?firstName
FROM <http://jena.apache.org/tutorials/sparql_data/vc-db-1.rdf>
WHERE {
?x vCard:Family ?lastName .
?x vCard:Given ?firstName .
?x vCard:Family "Jones"
}
@Lewiscowles1986
Lewiscowles1986 / fix-bluetooth-pulseaudio.sh
Created January 7, 2018 22:51
Fix Bluetooth Pulseaudio .5s lag
#!/bin/bash
mkdir -p ~/.pulse
cp /etc/pulse/default.pa ~/.pulse/default.pa
sed -i '' 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/g' ~/.pulse/default.pa
sudo -c 'echo <<EOF
[General]
Enable=Gateway,Source
package sample.animals;
import java.lang.IllegalArgumentException;
import java.lang.String;
public class Animal {
private String _name;
private int _legs;
public Animal(String name, int legs) {
@Lewiscowles1986
Lewiscowles1986 / runme.sql
Last active January 2, 2018 18:05
MySQL Bar chart Thing
/* Note that decimals can be passed but will be truncated to integer values */
SELECT REPEAT('█', 7) AS 'Percent'
UNION ALL
SELECT REPEAT('█', 7.5)
UNION ALL
SELECT REPEAT('█', 5)
UNION ALL
SELECT REPEAT('█', 15)
@Lewiscowles1986
Lewiscowles1986 / compile-wine.sh
Last active December 31, 2017 22:01
Compile Wine Release Candidate
#!/bin/sh
BRANCH="3.0"
RELEASE="wine-3.0-rc4"
CORECOUNT=`grep -c ^processor /proc/cpuinfo`
if [ ! -e "${RELEASE}.tar.xz" ]; then
wget "https://dl.winehq.org/wine/source/${BRANCH}/${RELEASE}.tar.xz"
else
echo "release '${RELEASE}' package already exists"
@Lewiscowles1986
Lewiscowles1986 / setPlaybackRateFromPromptNaive
Last active December 6, 2017 15:45
Simple way to set html5 playback rate. Should probably be minified as a bookmarklet
(function(){
function setAllMediaPlaybackSpeed(speed) {
[].slice.call(document.querySelectorAll('audio,video')).map( function(e, idx) {
e.playbackRate = speed;
});
}
var userRequestedRate = parseFloat(prompt("What playback rate would you like?"),10);
if(!isNaN(userRequestedRate)) {
setAllMediaPlaybackSpeed(userRequestedRate);
}
@Lewiscowles1986
Lewiscowles1986 / unblock-mens-health.js
Created October 29, 2017 11:27
Unblock mens health
[].slice.call(document.querySelectorAll('.ad-blocker-custom-blur')).map(function(elem,idx){
elem.className = '';
});
@Lewiscowles1986
Lewiscowles1986 / dedup.sh
Last active November 23, 2017 07:06
De-duplicate JPG Files
#!/bin/bash
PATH_TO_PROCESS="./"
if [ $# -ge 1 ]; then
PATH_TO_PROCESS=${1}
fi
JPEG_QUALITY=80
if [ $# -ge 2 ]; then
JPEG_QUALITY=${2}