Skip to content

Instantly share code, notes, and snippets.

View codersquid's full-sized avatar

Sheila Miguez codersquid

View GitHub Profile
@codersquid
codersquid / another_example.py
Last active March 26, 2024 05:41
a learning example for using a pushgateway with prometheus
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@codersquid
codersquid / local.py
Last active October 18, 2018 11:24
troubleshooting for FilterError for Pycon/pycon
# Copy this to local.py and edit.
# Do not add local.py to source control.
# Pick one: import whatever your appropriate settings are for this environment
# (probably ``.dev`` for local development)
from .dev import *
#from .test import *
#from .staging import *
#from .production import *
@codersquid
codersquid / s3parse.ipynb
Last active September 11, 2017 19:37
simple script to parse s3 access logs -- is brittle and does not handle errors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
I never freaking remember argparse syntax and the docs are so all over the place
that I need this for an example.
@codersquid
codersquid / cleandata.py
Last active July 27, 2017 01:37
code in unknown shape from when last I was scraping SciPy2015 schedule. I added html from the talk list page and a description page.
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import re
from bs4 import BeautifulSoup
from steve.util import (
#get_from_config,
get_project_config,
save_json_files,
load_json_files,
@codersquid
codersquid / cleandata.py
Created August 23, 2015 02:49
pyconza 2014 scratchpad
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
from collections import defaultdict
from steve.util import (
#get_from_config,
get_project_config,
save_json_files,
#load_json_files,
)
@codersquid
codersquid / debug-launch.sh
Last active October 17, 2016 19:40
quick script to troubleshoot what is going on with recursive push
#!/bin/sh
set -ex
LXC=/home/sheila/gopath/bin/lxc
COUNT=${1:-5}
echo making $COUNT test files
rm -rf exampledir
@codersquid
codersquid / zoteroworkflow.md
Last active July 15, 2016 16:25
quick run through of how I handle adding records for the pdfs in the shared folder. please share advice.

Race and Policing Research Zotero group.

Dropbox folder (Contact @aasewell, status, for password details)

Hi all,

I will describe how I've been using zotero to import records based on the existing PDFs in the folder.

Zotero has browser plugins and desktop clients. I use the browser plugin for Firefox and I have Zotero toolbar buttons on my browser.

#!/bin/bash
ID=400000 # some large uid outside of typical range, and outside of already mapped ranges in /etc/sub{u,g}id
_UID=$(id -u)
GID=$(id -g)
GROUP=$(id -gn)
# give lxd permission to map your user/group id through
sudo usermod --add-subuids ${_UID}-${_UID} --add-subgids ${GID}-${GID} root
# create a profile to control this, name it after $USER
@codersquid
codersquid / examplecors.xml
Created December 4, 2013 20:27
example files for setting up s3 bucket policies
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>http://*.researchcompendia.org</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
<CORSRule>