Skip to content

Instantly share code, notes, and snippets.

View jhargis's full-sized avatar

Jay Hargis jhargis

  • Heroku
  • Portland, OR
View GitHub Profile
@jhargis
jhargis / mk_playlist.py
Created May 16, 2015 12:07
Convert Grooveshark playlist files into .pls files for import into soundiiz.com
#!/usr/bin/python
# -*- coding: utf-8 -*-
#"SongName","ArtistName","AlbumName"
"""Convert Grooveshark playlist into .pls file for import into any music
service supported by http://soundiiz.com
usage: put this file in the same directory as the playlist you want to
convert. rename the file to tracks.csv then
@jhargis
jhargis / serve.py
Last active August 29, 2015 14:21 — forked from nigma/serve.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import webbrowser
from threading import Timer
os.environ["DJANGO_SETTINGS_MODULE"] = "webapp.settings"
import cherrypy
@jhargis
jhargis / django-cherrypy.py
Created May 20, 2015 15:13
another way to run django on the cherrypy server
# http://www.defuze.org/archives/262-hosting-a-django-application-on-a-cherrypy-server.html
# Python stdlib imports
import sys
import logging
import os, os.path
# Third-party imports
import cherrypy
from cherrypy.process import wspbus, plugins
from cherrypy import _cplogging, _cperror
@jhargis
jhargis / imagewiththumbnails_updateable.py
Last active August 29, 2015 14:27 — forked from valberg/imagewiththumbnails_updateable.py
Django create thumbnail form ImageField and save in a different ImageField - now with updating!
# Extension of http://www.yilmazhuseyin.com/blog/dev/create-thumbnails-imagefield-django/
# Note: image_folder and thumbnail_folder are both a callable (ie. a lambda that does a '/'.join())
class Image(Media):
image = models.ImageField(
upload_to=image_folder
)
thumbnail = models.ImageField(
@jhargis
jhargis / install.sh
Created June 22, 2012 01:40 — forked from crofty/install.sh
Redis install for ubuntu 8.04 without upstart
# Redis install instructions for systems without upstart
mkdir ~/redis
cd ~/redis
wget --no-check-certificate http://github.com/antirez/redis/tarball/v2.0.0-rc4 -O redis_v2.0.0-rc4.tar.gz && tar --strip-components 1 -xzvf redis_v2.0.0-rc4.tar.gz
make
sudo mv redis-server /usr/local/bin/
sudo mv redis-cli /usr/local/bin/
sudo mv redis-benchmark /usr/local/bin/
sudo mv redis-check-dump /usr/local/bin/
sudo mkdir /var/lib/redis
@jhargis
jhargis / node-and-npm-in-30-seconds.sh
Created July 18, 2012 18:45 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@jhargis
jhargis / rdio_pl_export.js
Created November 20, 2015 01:20 — forked from nloko/rdio_pl_export.js
Export Rdio playlist as CSV
javascript:(function() {
var bookmarklet = {
init: function() {
this.parse();
},
parse: function() {
page = "";
/* you must be viewing songs ie. http://www.rdio.com/people/nloko/collection/songs/
when exporting a collection and this will only export the songs loaded in view,
@jhargis
jhargis / encryptpw.pl
Created August 29, 2013 04:33
generate an htpasswd with perl script
#!/usr/bin/env perl
if ($#ARGV < 1) {
die("Usage:\tUsername Password\n")
}
my $username = shift;
my $newpass = shift;
my $new_entry;
my @entry = split(':', $_);
@jhargis
jhargis / supervisor.conf
Created August 30, 2016 22:52 — forked from tsabat/supervisor.conf
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@jhargis
jhargis / README.md
Last active February 15, 2017 03:09
letsencrypt certbot nginx easy setup and renewals

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {