Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ShaneQful
ShaneQful / mountJollaHome.sh
Created May 13, 2016 18:43
mount Jolla home directory in recovery mode as a writable filesystem
mount -t btrfs -o skip_balance, subvol=@home /dev/mmcblk0p28 /myhome
@ShaneQful
ShaneQful / CheckPackages.sh
Last active September 10, 2016 14:36
A bash one liner to check if any of your dependent npm packages have a low number of stars on github
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 February 24, 2014 21:08
Checks for lastest episode of LAS and dowloads it if there's a new episode
#!/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 December 21, 2013 20:36
Kris Kindle Algorithm in JS, using Google's AppScript to send emails to everyone involved
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 March 29, 2013 00:05
Grabs YouTube captions and outputs text for however many lines you want. Wrote it to translate Italian news with my sister in it.
for(var i = 0; i < 12; i++){
console.log($('#cp-'+i).innerText.replace(/\d:\d+/, ''));
}
@ShaneQful
ShaneQful / unspotify.js
Last active December 14, 2015 18:29
Get rid of friends' spotify spamming your feed
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 December 14, 2015 13:38
To help someone on r/raspberry_pi
#!/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 February 18, 2013 12:20
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.
#!/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 December 11, 2015 02:39
Send desktop notification through the CLI :) because I forget I running stuff some times.
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 July 19, 2019 04:59
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.
#!/usr/bin/ruby
require "open3"
def bash input
streams = Open3.popen3 input
out = ""
while((line=streams[1].gets) != nil)
out += line
end
return out