Skip to content

Instantly share code, notes, and snippets.

@viviparous
viviparous / pcritic.sh
Created July 6, 2015 02:06
linux: call bash script from find command; bash script runs perlcritic on each file found; output appended to file, separated by name of file examined
#! /bin/bash
#find lib/ -type f -name "*.pm" | while read file; do ./pcritic_shell.sh "$file"; done
OFILE=critic_out.txt
echo Process $1
echo "= = = = = = = =" >> $OFILE
echo "= = = = = = = =" >> $OFILE
@viviparous
viviparous / gist:fb3742f54e7338671fdd7df7fff3cf5f
Last active December 29, 2021 17:14
Rip entire audio CD to a single file ("bin" format), playable by mplayer. Good for classical music, jazz, and other music that is best listened to "whole".
Rip entire audio CD to a single file ("bin" format), playable by mplayer.
Good for classical music, jazz, and other music that is best listened to "whole".
On Linux: easy to do.
On M-Windows: takes time to *find* the binary tools or compile them yourself.
Tools to use:
dd
toc2cue (comes with cdrdao)
bchunk
@viviparous
viviparous / chat.go
Created May 30, 2016 09:44
simple golang chat server
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@viviparous
viviparous / SimpleHTTPServerWithUpload.py
Created July 16, 2016 20:52 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@viviparous
viviparous / geany.perl_snippets.conf
Last active May 11, 2019 10:47
perl entries for Geany's snippets.conf file
#In Geany, open the snippets.conf file: Tools→Configuration Files→snippets.conf
#add these entries
[Special]
bracescompact={my $p=shift; my $rv=0; if(\s$p eq "something"\s) {\s%cursor%\s; $rv=1; } return $rv; }\n
[Perl]
if=if (\s%cursor%\s)%bracescompact%
sub=sub mySub %bracescompact%
package=package myPkg {\n\tsub new {my ($class,$name)=@_;\n\tmy $self={\n\tval1=>$name||$class,\n\tval2=>"default",\n\tval3=>()\n\t};\n\tmy $obj=bless $self,$class;\n\t$obj->_init;\n\treturn $obj;\n\t}\n\tsub _init %bracescompact%\n};\n
@viviparous
viviparous / gist:bee0108376966efb02671aaab4de2afe
Created July 3, 2017 09:10
Configure dnsmasq from scratch on Debian
Assumption: you know how to install dnsmasq, and you have done so.
##############################/etc/default/dnsmasq
#contains useful information
#IGNORE_RESOLVCONF=yes
##############################/etc/resolv.conf
domain home
search home
nameserver 127.0.0.1
@viviparous
viviparous / wav2flac.sh
Last active December 1, 2021 03:10 — forked from amitsnyderman/wav2flac.sh
Convert wav to flac (16-bit / 44.1 kHz)
find . -iname "*.wav" -exec ffmpeg -i {} -af aformat=s16:44100 {}.flac \;
@viviparous
viviparous / gist:efa21bd6374824ba8332a3a4ac7b4585
Created February 9, 2024 23:54
Use bash , ncal , Perl to list years, months, and weeks with week numbers
#! /usr/bin/env bash
#use ncal and perl to list weeks in a year range
#arg 1 year_start
#arg 2 year_end
ystt=$1
yend=$2