Skip to content

Instantly share code, notes, and snippets.

View johnrichardrinehart's full-sized avatar

John Rinehart johnrichardrinehart

View GitHub Profile
var Promise = require("bluebird");
var bhttp = require("bhttp");
var taskQueue = require("promise-task-queue");
var MongoClient = require('mongodb');
var queue = taskQueue();
var failedRequests = 0;
//const alphabet = "abcdefghijklmnopqrstuvwxyz"
//const urls =[]
//for (let i=0 ; i < 4; i++) {
@johnrichardrinehart
johnrichardrinehart / znc_cleanup.sh
Created January 18, 2017 01:01
ZNC log cleanup (cleans up messages and old logs)
#!/bin/bash
DATE=`date +%Y-%m-%d--%H:%M:%S`;
ZNCCLEANDIR=/home/john/znc_clean;
ZNCLOGDIR=/home/john/.znc/users/fuzzybear3965/networks/lovelace_freenode/moddata/log;
MESSAGESFILENAMERELATIVE="messages_$DATE.log";
OLDLOGSFILENAMERELATIVE="oldlogs_$DATE.log";
MESSAGESFILENAME=$ZNCCLEANDIR/$MESSAGESFILENAMERELATIVE;
OLDLOGSFILENAME=$ZNCCLEANDIR/$OLDLOGSFILENAMERELATIVE;
if [ -f $MESSAGESFILENAME ]; then
set nocompatible
filetype plugin on
set rtp=$HOME/vimfiles/bundle/vimtex
set rtp+=$HOME/vimfiles/bundle/vimtex/after
let g:vimtex_view_general_viewer='SumatraPDF'
```diff,python
def foo():
- a = 0
+ a = 1
return
```
\documentclass{article}
\newenvironment{env}[2]{env is #1 and #2}{}
\begin{document}
\begin{env}{amazing, wonderful}
\end{env}
\end{document}
if not os.path.exists(os.path.dirname(filename)):
try:
os.makedirs(os.path.dirname(filename))
except OSError as exc: # protects against race conds
if exc.errno != errno.EEXIST:
printToLog("Failed to make the directory!",1)
raise
with open(filename,"w") as f:
for chunk in res.iter_content(2**20):
f.write(chunk)
// The above is courtesy of @moldy via #django (freenode)
frameworks:
Django, flask, Werkzeug, Cherrypy, Rails
languages:
Ruby, Python
WSGI servers:
gunicorn, uWSGI, apache (with mod_wsgi)