Skip to content

Instantly share code, notes, and snippets.

View sbussetti's full-sized avatar

Steve Bussetti sbussetti

  • New Jersey, USA
View GitHub Profile
@evildmp
evildmp / inserts.py
Created July 2, 2011 17:59
Inserts for Django CMS - freestanding placeholders for templating
The easiest thing is to explain how you use them:
1. define an insertion point in your template(s) using
{% insert "my_insertion_point" %}
The {% insert %} templatetag will then get_or_create() the appropriate
Insert in the database
2. the user visits the Insert in the admin, and adds plug-based
@philchristensen
philchristensen / gist:5147023
Created March 12, 2013 21:06
Show how to read from the nagios datafile
#!/usr/bin/python
import os.path, datetime, sys
import termcolor
datfile = "/opt/local/var/nagios/status.dat"
def main(infile):
if os.path.exists(datfile) == False:
@philchristensen
philchristensen / YQL.py
Created April 29, 2013 19:41
Example of querying the YQL console.
import restkit
import simplejson
YQL_URL = ('http://query.yahooapis.com', '/v1/public/yql')
value = '11215'
pmr = restkit.Resource(YQL_URL[0])
query = 'SELECT * FROM geo.places WHERE text = "%s"'
qs = value.replace(r'"', r'\"')
@sbussetti
sbussetti / shieldsmasher.sh
Last active May 2, 2018 19:09
shieldsmasher
#!/usr/bin/env bash
MAX_PROCS=${1:-10};
ispinner () {
i=1
sp="/-\|"
while true; do
echo -en "\033[0;0f"
printf "\b${sp:i++%${#sp}:1}"
@gplv2
gplv2 / postgres_queries_and_commands.sql
Last active July 3, 2018 11:44 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- performance tools
-- https://www.vividcortex.com/resources/network-analyzer-for-postgresql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (post 9.2)
@mllrjb
mllrjb / jdk-installers.groovy
Last active July 4, 2020 10:42
Jenkins init.groovy.d JDK Installer
import jenkins.model.*
import hudson.model.*
import hudson.tools.*
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("hudson.model.JDK")
def versions = [
"jdk8": "jdk-8u102-oth-JPR"
@pyk
pyk / installing postgresql 9.3.2 on ubuntu 12.04.md
Created January 3, 2014 18:05
installing postgresql 9.3.2 on ubuntu 12.04 . with error fix: ummet dependencies

installing postgresql 9.3.2 on ubuntu 12.04

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.3 postgresql-contrib-9.3

you should succesfully installing postgresql 9.3.2 on your machine.

@ipedrazas
ipedrazas / knife cheat
Last active December 13, 2021 11:50
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@kanzure
kanzure / git-commit-cleaner.py
Last active May 17, 2022 17:25
git-filter-branch examples and notes
"""
Creates pretty-looking commit messages for git. This was created to pretty
print the old-commit-id values for filter-branched-rewritten commits in
pyphantomjs from the phantomjs repository.
"""
import os
import sys
@ivanvanderbyl
ivanvanderbyl / gist:4222308
Created December 6, 2012 06:55
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"