Skip to content

Instantly share code, notes, and snippets.

@ShaneQful
ShaneQful / mountJollaHome.sh
Created May 13, 2016
mount Jolla home directory in recovery mode as a writable filesystem
View mountJollaHome.sh
mount -t btrfs -o skip_balance, subvol=@home /dev/mmcblk0p28 /myhome
@ShaneQful
ShaneQful / CheckPackages.sh
Last active Sep 10, 2016
A bash one liner to check if any of your dependent npm packages have a low number of stars on github
View CheckPackages.sh
npm ls | grep -oP "\w[^@]+@" | sed s/@// | sort |uniq | awk '{print "npm view " $1 " repository.url"}' | sh | grep -oP "github(\w|\W)+\.git" | sed 's/.git//g' | sed 's/.com/.com\/repos/g' | awk '{print "curl -s \"https://api."$1"\" | grep -P \"(stargazers_count|full_name)\" "}' | sh
@ShaneQful
ShaneQful / LASDowloader.sh
Created Feb 24, 2014
Checks for lastest episode of LAS and dowloads it if there's a new episode
View LASDowloader.sh
#!/bin/bash
BEFORE=0
while true
do
wget http://feeds.feedburner.com/linuxashd -q -O las.feed
NOW=$(wc -c las.feed | grep -o -P "\d+")
if [ "$NOW" -ne "$BEFORE" ] ; then
wget $(grep -o -P "url(\s|\S)+\.mp4" las.feed | head -1 | cut -c 6-)
fi
BEFORE=$NOW
@ShaneQful
ShaneQful / KrisKindle.js
Created Dec 21, 2013
Kris Kindle Algorithm in JS, using Google's AppScript to send emails to everyone involved
View KrisKindle.js
function krisKindle() {
"use strict";
var peopleInKrisKindle, bag, key, giver,firstGiver, reciever, sendMail;
sendMail = function(giver, reciever) {
var email = peopleInKrisKindle[giver],
subject = "Secret Santa",
message = "You have to get a gift for " + reciever;
MailApp.sendEmail(email, subject, message);
};
peopleInKrisKindle = {
@ShaneQful
ShaneQful / gist:5267823
Created Mar 29, 2013
Grabs YouTube captions and outputs text for however many lines you want. Wrote it to translate Italian news with my sister in it.
View gist:5267823
for(var i = 0; i < 12; i++){
console.log($('#cp-'+i).innerText.replace(/\d:\d+/, ''));
}
@ShaneQful
ShaneQful / unspotify.js
Last active Dec 14, 2015
Get rid of friends' spotify spamming your feed
View unspotify.js
var f = document.getElementsByClassName('fbFeedTickerStory');
for(var i = 0; i < f.length; i++){
if(f[i].innerHTML.indexOf("spotify") !== -1){
f[i].style.display="none";
}
}
@ShaneQful
ShaneQful / feedalarmer.sh
Last active Dec 14, 2015
To help someone on r/raspberry_pi
View feedalarmer.sh
#!/bin/bash
BEFORE=0
while true
do
wget https://news.ycombinator.com/rss -q -O test
NOW=$(wc -c test | grep -o -P "\d+")
if [ "$NOW" -ne "$BEFORE" ] ; then
mplayer Alert.ogg
fi
@ShaneQful
ShaneQful / generate_transactions.rb
Created Feb 18, 2013
Generator Script for Information Systems 2 Assignment Note: This was not part of the assignment and therefore it isn't plagiarism to use this & obviously there is no point submitting this code.
View generate_transactions.rb
#!/usr/bin/ruby
=begin
Copyright (c) 2013 Shane Quigley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@ShaneQful
ShaneQful / gist:4532265
Last active Dec 11, 2015
Send desktop notification through the CLI :) because I forget I running stuff some times.
View gist:4532265
sudo dd bs=1m if=~/2012-12-16-wheezy-raspbian.img of=/dev/sdc ; notify-send -t 2 -i /usr/share/icons/Humanity/apps/128/gnome-terminal.xpm "Pi Imaged"
@ShaneQful
ShaneQful / diary_indexer.rb
Last active Jul 19, 2019
Something I made to make a diary for my final year project. Markdown to html, create a table of contents for each entry, commit to the repo & scp to web directory on the server. Now with fancier table of contents.
View diary_indexer.rb
#!/usr/bin/ruby
require "open3"
def bash input
streams = Open3.popen3 input
out = ""
while((line=streams[1].gets) != nil)
out += line
end
return out