Skip to content

Instantly share code, notes, and snippets.

@rokcarl
rokcarl / gist:0844ffb917facb8b5822
Created December 31, 2014 09:32
github_read_file_from_private_repo.py
import requests
auth = ('username', 'password')
filepath = '/views/index.py'
result = requests.get('https://api.github.com/repos/:company/:repo/contents{}'.format(filepath), auth=auth).json()
@rokcarl
rokcarl / m.py
Created April 9, 2015 12:19 — forked from lukmdo/m.py
from __future__ import print_function
from functools import wraps
class Fish(object):
def __new__(cls, *args, **kwargs):
o = super(Fish, cls).__new__(cls, *args, **kwargs)
o.type = 'goldfish'
for name, val in vars(cls).items():
@rokcarl
rokcarl / 0_reuse_code.js
Created December 28, 2015 08:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rokcarl
rokcarl / git-checkout-PR.sh
Created December 28, 2015 10:26
Git checkout PR
echo "Type the PR number, e.g. 358."
read PR_NO
git fetch upstream pull/$PR/head:pr-$PR;
git checkout pr-$PR;
CRON_TEXT="
0 1 * * * cmd1 2>&1
0 */4 * * * cmd2 2>&1
"
printf "${CRON_TEXT}" | crontab -u zengrc -
cron
@rokcarl
rokcarl / change-url-parameters.py
Last active January 29, 2024 12:25
Update URL parameters in Python 3.
import urllib.parse
url = "http://stackoverflow.com/search?q=question"
params = {'lang':'en','tag':'python'}
url_parts = list(urllib.parse.urlparse(url))
query = dict(urllib.parse.parse_qsl(url_parts[4]))
query.update(params)
url_parts[4] = urllib.parse.urlencode(query)
@rokcarl
rokcarl / README.md
Last active February 26, 2021 08:35
Get GeoNode on 3.1 working with HTTPS, custom certs.
  1. Put certs in /etc/ssl/: maps.company.com.pem and maps.company.com.key.
  2. Put nginx.conf in the root of the project.
  3. Apply the diff for docker-compose.yml.
  4. Add your .env file.
  5. Run project with docker-compose up -d.