Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am pcn on github.
* I am pcn (https://keybase.io/pcn) on keybase.
* I have a public key ASDjtmPgt3MLMBGnNhrn9Fd4QeCpnO4omse7daJTsfZZFAo
To claim this, I am signing this object:
def __get_gh_repos(teamname):
'''
looks up team ID from the organization then returns a list of repos
for which that team are collaborators
'''
params = ''
base_url = 'https://api.github.com/'
headers = { 'Accept' :'application/vnd.github.v3+json', "Content-type" : "application/json", \
'User-Agent' : 'dmangot@librato.com', 'Authorization': 'token ' + app.config['GH_API_TOKEN'] }
req = requests.get(base_url + 'orgs/librato/teams', auth=(app.config['GH_API_TOKEN'], 'x-oauth-basic')).text
@pcn
pcn / ntpq.py
Created December 13, 2016 19:25
A subset of ntqp in python based on ntp python lib
#!/usr/bin/env python
# pragma pylint: disable=bad-whitespace
###############################################################################
# ntpq.py - Python NTP control library.
# Copyright (C) 2016 Peter C. Norton (@pcn on github)
#
# this addition to ntplib is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your option)
@pcn
pcn / master.log
Created December 7, 2016 21:25
saltstack redis returner is complaining when trying to delete keys?
2016-12-07 21:22:05,549 [salt.utils.process][ERROR ] An un-handled exception from the multiprocessing process 'Maintenance-9' was caught:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/utils/process.py", line 623, in _run
return self._original_run()
File "/usr/lib/python2.7/dist-packages/salt/master.py", line 237, in run
salt.daemons.masterapi.clean_old_jobs(self.opts)
File "/usr/lib/python2.7/dist-packages/salt/daemons/masterapi.py", line 187, in clean_old_jobs
mminion.returners[fstr]()
File "/usr/lib/python2.7/dist-packages/salt/returners/redis_return.py", line 220, in clean_old_jobs
serv.delete(*to_remove)
@pcn
pcn / test-flask-rq2.py
Last active December 3, 2016 05:48
Using rq and flask-rq2 to create a queue with some variations
#!/usr/bin/env python
from flask import Flask, request, jsonify, redirect, url_for, Response
import sys, json, requests, re
import os
import logging
import logging.handlers
import time
from redis import Redis
@pcn
pcn / aal.rs
Last active September 28, 2016 02:13
OK ec2 api, what are the expected characters?
```
extern crate docopt;
extern crate rusoto;
extern crate awsshuf;
extern crate serde;
extern crate serde_json;
use rusoto::Region;
use rusoto::ec2::{Ec2Client, DescribeInstancesRequest};
@pcn
pcn / debug_log.md
Created May 27, 2016 19:35
Setup tasks failing
DEBUG [SharedPool-Worker-1] 2016-05-27 19:34:08,397 AbstractQueryPager.java:95 - Fetched 13 live rows
DEBUG [SharedPool-Worker-1] 2016-05-27 19:34:08,397 AbstractQueryPager.java:112 - Got result (13) smaller than page size (8192), considering pager exhausted
DEBUG [SharedPool-Worker-1] 2016-05-27 19:34:08,397 AbstractQueryPager.java:133 - Remaining rows to page: 2147483634
DEBUG [SharedPool-Worker-3] 2016-05-27 19:34:08,397 AbstractQueryPager.java:95 - Fetched 12 live rows
DEBUG [SharedPool-Worker-3] 2016-05-27 19:34:08,397 AbstractQueryPager.java:112 - Got result (12) smaller than page size (8192), considering pager exhausted
DEBUG [SharedPool-Worker-3] 2016-05-27 19:34:08,397 AbstractQueryPager.java:133 - Remaining rows to page: 2147483635
DEBUG [SharedPool-Worker-1] 2016-05-27 19:34:08,404 SliceQueryPager.java:92 - Querying next page of slice query; new filter: SliceQueryFilter [reversed=false, slices=[[00080000000057489ec900, 0008000000005748a11f01]], count=32768, toGroup = -1]
DEBUG [SharedPool-Worke
@pcn
pcn / jstack_output.md
Last active May 10, 2016 16:55
NPE while disabling thrift in 2.2.5
2016-05-10 16:52:45
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode):

"Keep-Alive-Timer" #555196 daemon prio=8 os_prio=0 tid=0x00007f535aed89b0 nid=0x5625 waiting on condition [0x00007f5376841000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at sun.net.www.http.KeepAliveCache.run(KeepAliveCache.java:172)
	at java.lang.Thread.run(Thread.java:745)
@pcn
pcn / repl.md
Last active March 29, 2016 06:00
Why is clojure throwingout NPEs when I'm trying to just complete something simple?
$ lein repl
nREPL server started on port 34819 on host 127.0.0.1 - nrepl://127.0.0.1:34819
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 9-internal+0-2016-01-26-152615.buildd.src
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
@pcn
pcn / iperf_server_output.md
Created February 11, 2016 17:20
what is iperf telling me

I definitely did something wrong here.

dogfood:~$ iperf -s -l 1m -w 4m -m
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 8.00 MByte (WARNING: requested 4.00 MByte)
------------------------------------------------------------
[  4] local 172.26.196.49 port 5001 connected with 172.26.197.120 port 50595
[  5] local 172.26.196.49 port 5001 connected with 172.26.197.120 port 50596