Sunday, August 28, 2016

Shit I learned about linux, in like, this morning and last night when I didn't sleep, and maybe other times, 147235608

I made my terrible bash script that counts language stuff from github completely automated. I also wrote like a real post, that I'm still proofing. I'm going to probably actually try to promote it, so there's that. This is a lot easier to work with now, though it still lacks any robustness, so one mistep and it's not going to work. Plus, right now it creates and deletes files, which is a horrible way to solve my goal but it was a quick way. So I assume if I have time I'll fix that in the future. I did go ahead and copy and paste a few lines of R so I can get a graph from it as well.

Enter your github token, if you have one. Otherwise hit enter:

Enter which github user you would like to check percentages on: bsdpunk
Total LoC: 367611
AppleScript 696 0.189331%
Awk 539 0.146622%
Go 6761 1.83917%
JavaScript 8323 2.26408%
Perl 23081 6.27865%
PHP 20528 5.58416%
Python 302957 82.4124%
R 1926 0.523923%
Shell 2800 0.761675%
One of the things I learned today was that you can delete a line and as many lines after it with sed:
 sed '/true/,+1d'
So match true, delete the line it's on, and the one after it. The Rscript that makes the graph in my github piece is ridiculous simple. R is really just a pleasure to use. I miss doing the draft kings stuff with it.
locs <- read.csv('loc.csv', header=TRUE, sep=",")
title(main = commandArgs(TRUE)[1])
The bash script that does most the heavy lifting, is just a mess. I mean I've done some crappy one liners before, but this just feels bad. I guess I could clean it up. Here's a little php, to send an email:
php -r '$msg="tasty message";mail("","My subject",$msg);'
And how to force curl, to use a domain, that isn't assigned to an IP(in case you don't want to fuck with your host file):
curl --header ""

No comments: