Skip to content

Instantly share code, notes, and snippets.

@shannietron
shannietron / makeScanned.fish
Created Jul 10, 2020
make your files look like they went through dead trees.
View makeScanned.fish
function makeScanned
convert -density 150 $argv[1] -colorspace gray -linear-stretch 3.5%x10% -blur 0x0.5 -attenuate 0.25 +noise Gaussian -rotate 0.5 temp.pdf
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -sColorConversionStrategy=LeaveColorUnchanged dAutoFilterColorImages=true -dAutoFilterGrayImages=true -dDownsampleMonoImages=true -dDownsampleGrayImages=true -dDownsampleColorImages=true -sOutputFile=output.pdf temp.pdf
end
#idea from this HN thread
#https://news.ycombinator.com/item?id=23160387
@shannietron
shannietron / doubleDabble.c
Created Dec 22, 2018
Implementation of the double dabble algorithm to convert binary to BCD.
View doubleDabble.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *binary(unsigned int dec);
int main(int argc, char * argv [] ){
unsigned int input = strtol(argv[1],NULL,10);
unsigned int temp = 0x0;
View keybase.md

Keybase proof

I hereby claim:

  • I am shannietron on github.
  • I am shannietron (https://keybase.io/shannietron) on keybase.
  • I have a public key ASC_6j4_fXThxThWHawNnGjFKTT5Vzobr-EwbOpJViMwHwo

To claim this, I am signing this object:

@shannietron
shannietron / ytplay.fish
Last active Nov 12, 2018
Youtube downloader
View ytplay.fish
function ytplay
youtube-dl -f bestaudio $argv[1] -o - | mplayer -
end
@shannietron
shannietron / streamTube
Created May 4, 2016
Streams youtube videos using youtube-dl and mplayer
View streamTube
#!/bin/bash
while read line
do
name=$line
echo "Playing - $name"
youtube-dl -f 141 $name -o - | mplayer -
# youtube-dl -x --audio-format mp3 --audio-quality 0 -o "%(title)s.%(ext)s" $name
done < $1
@shannietron
shannietron / power.fish
Last active Aug 29, 2015
Calculate how much power your Macbook is nomming.
View power.fish
function power
set amp (system_profiler SPPowerDataType | awk '/Amperage/{ print $3 }')
set volt (system_profiler SPPowerDataType | awk '/Voltage/{ print $3 }')
set power (echo "scale=2; ($volt * $amp)/1000000"| bc -l)
echo $power"W"
end