Skip to content

Instantly share code, notes, and snippets.

View maxclark's full-sized avatar

Max Clark maxclark

View GitHub Profile
brew install pam-u2f
mkdir -p ~/.config/Yubico/
pamu2fcfg > ~/.config/Yubico/u2f_keys
<Press the U2f device>
cat ~/.config/Yubico/u2f_keys # should output <your username>:<really long hash>
In /etc/pam.d/screensaver
Add to the top:
auth sufficient pam_u2f.so
@maxclark
maxclark / random.py
Created August 26, 2019 18:40
Random number generator in Python
#!/usr/bin/env python
from random import randint
for i in range(20):
print(randint(11111,99999))
@maxclark
maxclark / netsapiens-polycom.sh
Created August 26, 2019 18:39
Rename Polycom firmware files for import into NetSapiens Endpoints
#!/bin/bash
# echo "Type the firmware version follwed by [ENTER]"
# read version
# read version<sip.ver
version=`head -1 sip.ver`
echo "$version"
echo "sip${version}-spip321.uc.ld"
@maxclark
maxclark / fs_rotate.sh
Created April 13, 2018 17:15
Simple script to rotate FreeSWITCH CDRs for our BSS platform
#!/bin/sh
SOURCE=/var/log/freeswitch/cdr-csv
PICKUP=/home/cdr/cdr
ARCHIVE=/home/cdr/archive
# Instructs FreeSWITCH to rotate the CDR file
#
#/bin/kill -HUP `cat /usr/local/freeswitch/run/freeswitch.pid`
/usr/bin/fs_cli -x 'cdr_csv rotate'
@maxclark
maxclark / curl-format.txt
Created March 8, 2018 17:29
curl -w "@curl-format.txt" -o /dev/null -s "hostname"
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
@maxclark
maxclark / MOTD
Created June 25, 2015 18:16
This MOTD file was adapted from FBI suggestions for system disclosure.
This system is for the use of authorized users only. Individuals using this
system without authority, or in excess of their authority, are subject to having
all of their activities on this system monitored and recorded by system
personnel.
In the course of monitoring individuals improperly using this system, or in the
course of system maintenance, the activities of authorized users may also be
monitored.
Anyone using this system expressly consents to such monitoring and is advised
#!/usr/bin/perl
#
# Small program that writes email data to a database
# for logging purposes and monthly analysis.
use strict;
use Getopt::Long;
use MIME::Words qw(:all);
use DBI;
@maxclark
maxclark / dedupe.pl
Created June 16, 2014 21:27
Removes duplicates from the input file (first parameter on command line) and saves clean/dupe files to separate files
#!/usr/bin/perl
# removes duplicates from the input file (first parameter on command line) and saves clean/dupe files to separate files
$file = $ARGV[0];
open (FILE, $file);
open (CLEAN, ">clean.txt");
open (DUPES, ">dupes.txt");
#undef $/;

Keybase proof

I hereby claim:

  • I am maxclark on github.
  • I am maxclark (https://keybase.io/maxclark) on keybase.
  • I have a public key whose fingerprint is B984 3C33 4A9D 2094 B29D 936C 7565 2AA3 9705 A61A

To claim this, I am signing this object:

@maxclark
maxclark / range.sql
Last active August 29, 2015 14:01
Repeat a query inserting a range of numbers
INSERT into orig_route_cos_dest (orig_route_id, priority, class_dest, final)
SELECT gs.i, '1', 'bg:14', 't' f
FROM generate_series(417, 437) gs(i);