Skip to content

Instantly share code, notes, and snippets.

@shannietron
shannietron / makeScanned.fish
Created July 10, 2020 05:09
make your files look like they went through dead trees.
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 December 22, 2018 18:29
Implementation of the double dabble algorithm to convert binary to BCD.
#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;

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 November 12, 2018 19:45
Youtube downloader
function ytplay
youtube-dl -f bestaudio $argv[1] -o - | mplayer -
end
@shannietron
shannietron / streamTube
Created May 4, 2016 14:16
Streams youtube videos using youtube-dl and mplayer
#!/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 August 29, 2015 14:17
Calculate how much power your Macbook is nomming.
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