Skip to content

Instantly share code, notes, and snippets.

View cadu-leite's full-sized avatar
🐍

Carlos C. Leite cadu-leite

🐍
View GitHub Profile
@simonw
simonw / export-google-docs-to-restructured-text.js
Last active August 9, 2024 12:02
Google Apps script to convert a Google Docs document into reStructuredText
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Convert to .RST')
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText')
.addToUi();
}
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini
// License: Apache License Version 2.0
String.prototype.repeat = String.prototype.repeat || function(num) {
@nstarke
nstarke / python-security-vulnerability-egrep.sh
Last active December 26, 2018 19:43
Python Security Vulnerability Egrep
# this command will return places where the application shells out or dynamically executes code:
egrep -r --include "*.py" -e "exec\(|eval\(|subprocess|popen" .
# DJANGO: find places where HTML encoding is turned off via the "safe" attribute:
grep -r --include "*.py" --include "*.html" -e "|safe" .
# DJANGO: find places where unsafe SQL queries are executed:
egrep -r --include "*.py" -e "\.(raw|execute)\(" .
# Non zero values indicate that some sort of CSRF protection is probably enabled.
@joshuapowell
joshuapowell / gist:e209a4dac5c8187ea8ce
Last active March 11, 2023 18:37
Setup Postgres.app to use PostGIS on OS X

Download and Install Postgres.app

Before we can setup PostGIS we need to have a local version of Postgresql installed and running. The most effecient way to do this is to download and install Postgres.app.

Spatially Enable your Postgres Database

Once Postgres.app is installed in your computers /Applications directory. Open the Terminal and enter the following two commands

psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/9.3/share/postgresql/contrib/postgis-2.1/postgis.sql
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@tomster
tomster / .gitconfig
Created September 25, 2011 11:48
An example git configuration including convenience aliases, some saner default behavior, a neat shell prompt and tab completion that can display the name of the tracking remote
# ~/.gitconfig
[branch]
autosetupmerge = true
[push]
default = current
[core]
excludesfile = .gitignore
@revolunet
revolunet / munin-django-models.py
Created March 2, 2011 12:36
graphs your django model instances with munin
#!/usr/bin/python
#
# Author : Julien Bouquillon ([email protected]) - revolunet team
#
# this munin plugin generate graphs with evolution of all registered django models
# install : copy, chmod +x then ln -s in /etc/munin/plugins
#
# project root
import sys
@thecatwasnot
thecatwasnot / .conkyrc-todo
Created October 17, 2010 23:38
GTD w/Linux notify-send/conky/remind/task
# Create own window instead of using desktop (required in nautilus)
# own_window yes
# own_window_type override
background no
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)