Skip to content

Instantly share code, notes, and snippets.

View mgregoro's full-sized avatar
🏄‍♂️
enjoying the internet superhighway

Michael Gregorowicz mgregoro

🏄‍♂️
enjoying the internet superhighway
  • Wayne State University
  • Detroit, MI
  • X @mgregoro
View GitHub Profile
@mgregoro
mgregoro / stop_scdaemon.pl
Created May 31, 2017 20:15
stops scdaemon politely then rudely.
#!/usr/bin/env perl
use strict;
use v5.10;
use Time::HiRes;
use subs qw/scdaemon_pid/;
$SIG{ALRM} = \&force_kill;
if (my $pid = scdaemon_pid) {
@mgregoro
mgregoro / totp.pl
Created June 22, 2017 15:02
Proof of concept TOTP implementation in perl... 20 second overlap.. reads "secret" from ARGV
#!/usr/bin/env perl
# (c) 2017 Michael Gregorowicz
# requires libsodium (with dev files), Crypt::Sodium, and MIME::Base32 to work
# 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

Keybase proof

I hereby claim:

  • I am mgregoro on github.
  • I am mg2 (https://keybase.io/mg2) on keybase.
  • I have a public key whose fingerprint is C42B 3924 7C21 7F4F FABA B26B B711 F1DA D027 93BE

To claim this, I am signing this object:

@mgregoro
mgregoro / scan.sh
Created June 27, 2018 15:29
Perl One-liner: Find size of all subdirectories in a given path; and report time taken to scan sub-directory
perl -MString::ShellQuote -E 'opendir(DIR, $ARGV[0]) or die "no: $!\n"; while (my $dir = readdir(DIR)) { next if $dir =~ /^\.+$/; if (-d join(q|/|, join(q| |, @ARGV), $dir)) { say "---------- START $dir ----------"; system("bash -c \"time du -hs @{[shell_quote_best_effort(join(q|/|, join(q| |, @ARGV), $dir))]}\""); say "----------- END $dir -----------\n" }}' $HOME/Library