Skip to content

Instantly share code, notes, and snippets.

View jvperrin's full-sized avatar

Jason Perrin jvperrin

View GitHub Profile
@jvperrin
jvperrin / vector.log
Created April 16, 2022 01:48
vector-output from /var/log/vector.log
{"host":"93331cf6a326","log":{"file":"/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/poll.rs","line":501,"module_path":"mio::poll","target":"mio::poll"},"message":"registering event source with poller: token=Token(1), interests=READABLE | WRITABLE","metadata":{"kind":"event","level":"TRACE","module_path":null,"target":"log"},"pid":481,"source_type":"internal_logs","timestamp":"2022-04-16T01:27:13.984764214Z"}
{"host":"93331cf6a326","log":{"file":"/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/poll.rs","line":501,"module_path":"mio::poll","target":"mio::poll"},"message":"registering event source with poller: token=Token(2), interests=READABLE | WRITABLE","metadata":{"kind":"event","level":"TRACE","module_path":null,"target":"log"},"pid":481,"source_type":"internal_logs","timestamp":"2022-04-16T01:28:02.627987669Z"}
{"host":"93331cf6a326","log":{"file":"/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/poll.rs","line":632,"module_path":"mio::poll","target":"mio::poll"},
#!/usr/bin/env python3
import ldap3
import ssl
server = ldap3.Server('dev-ldap.ocf.berkeley.edu', use_ssl=True)
connection = ldap3.Connection(server, authentication=ldap3.SASL, sasl_mechanism='GSSAPI')
connection.bind()
print(connection.extend.standard.who_am_i())

Keybase proof

I hereby claim:

  • I am jvperrin on github.
  • I am jvperrin (https://keybase.io/jvperrin) on keybase.
  • I have a public key whose fingerprint is 9E29 E330 1DEA 8343 A5AA 57B2 4556 CDB7 5021 CA3E

To claim this, I am signing this object:

@jvperrin
jvperrin / log_counter
Created May 16, 2017 05:50
fallingrocks mirror bandwidth counter
#!/usr/bin/env python3
import operator
import os
MIRROR_PATH = '/opt/mirrors/ftp'
dists = { dist: { 'in': 0, 'out': 0 }
for dist in os.listdir(MIRROR_PATH)
if os.path.isdir(MIRROR_PATH + '/' + dist) }
jvperrin@supernova:~$ dig -x 169.229.226.203 @128.32.206.12
; <<>> DiG 9.10.3-P4-Debian <<>> -x 169.229.226.203 @128.32.206.12
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48636
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
@jvperrin
jvperrin / jbd2-spam
Created September 6, 2016 01:42
Spam from jbd2 causing high IO percentages. Seen with `echo 1 > /proc/sys/vm/block_dump`
Sep 5 18:40:38 jaws kernel: [847903.839868] jbd2/dm-0-8(1762): WRITE block 1074068640 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.839874] jbd2/dm-0-8(1762): WRITE block 1074068648 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.839876] jbd2/dm-0-8(1762): WRITE block 1074068656 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.839879] jbd2/dm-0-8(1762): WRITE block 1074068664 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.839882] jbd2/dm-0-8(1762): WRITE block 1074068672 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.840029] jbd2/dm-0-8(1762): WRITE block 1074068680 on dm-0 (8 sectors)
Sep 5 18:40:38 jaws kernel: [847903.846176] nfsd(2805): dirtied inode 52455962 (showbot_error.txt) on dm-0
Sep 5 18:40:38 jaws kernel: [847903.846186] nfsd(2805): dirtied inode 52455962 (showbot_error.txt) on dm-0
Sep 5 18:40:38 jaws kernel: [847903.846188] nfsd(2805): dirtied inode 52455962 (showbot_error.txt) on dm-0
Sep 5 18:40:38 jaws kernel: [847903.846212] nfsd(2805): W
@jvperrin
jvperrin / upload-to-box
Created July 14, 2016 23:43
Box.com recursive backup script
#!/usr/bin/env python3
import argparse
import getpass
import json
import os
import subprocess
import sys
import threading
import time
from io import BytesIO
@jvperrin
jvperrin / submit-ee16a-hw.sh
Last active November 5, 2015 09:57
A semi-fancy script to automate submission of EE 16A homework assignments and self-grades.
#!/bin/bash
HW_NAME=$(basename "$PWD")
if [[ $HW_NAME == *"grades" ]]
then
echo "Submitting self-grades!"
echo "Uploading the grades to the instructional servers..."
ssh ee16a "mkdir -p ~/classes/ee16a/$HW_NAME"
@jvperrin
jvperrin / stylesheet-analysis.js
Last active December 23, 2015 06:48 — forked from eltoob/gist:4586719
A script to use the chrome console to run analysis on number of selectors and rules in stylesheets on a page. A stylesheet reported as "null" means that the rules are not from a linked stylesheet but originate from style tags in the document.
var
styleSheets = document.styleSheets,
totalStyleSheets = styleSheets.length;
for (var j = 0; j < totalStyleSheets; j++){
var
styleSheet = styleSheets[j],
rules = styleSheet.cssRules,
totalRulesInStylesheet = rules.length,
totalSelectorsInStylesheet = 0;
@jvperrin
jvperrin / routes.rb
Created July 14, 2013 05:16
Route ordering oddity in Rails 4
# This ordering will not work:
resources :posts, :except => :index
get "/posts" => "posts#index", :as => :posts
# This ordering will work:
get "/posts" => "posts#index", :as => :posts
resources :posts, :except => :index
# Both work, however, in Rails 3.2.13.