Skip to content

Instantly share code, notes, and snippets.

View pagles's full-sized avatar

Yorgos Pagles pagles

View GitHub Profile
@pagles
pagles / site.py
Created November 12, 2010 09:42 — forked from fiee/site.py
# -*- coding: utf-8 -*-
"""
Extension for FeinCMS Page
"""
from django.conf import settings
from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
from django.utils.translation import ugettext_lazy as _
from feincms.module.page.models import Page, PageManager
@pagles
pagles / fabfile.py
Created December 9, 2010 12:09 — forked from coordt/fabfile.py
from __future__ import with_statement
from fabric.api import env, run, settings, hide
from fabric.decorators import hosts, runs_once
venv = "/home/websites/.virtualenvs/twtv3/"
env.user = 'webdev'
env.hosts = [
'192.168.1.10',
'192.168.1.11',
@pagles
pagles / gist:734655
Created December 9, 2010 12:10 — forked from idan/gist:723316
<!doctype html>
<html>
<head>
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
<script src="js/modernizr-1.6.min.js"></script>
<!--
Typekit needs to happen inside the HEAD, but below CSS, else we get the FOUT
http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/
-->
{% block typekit %}
@pagles
pagles / admin.py
Created June 17, 2011 13:17 — forked from dokterbob/admin.py
InlineAdmin mixin limiting the selection of related items according to criteria which can depend on the current parent object being edited.
class LimitedAdminInlineMixin(object):
"""
InlineAdmin mixin limiting the selection of related items according to
criteria which can depend on the current parent object being edited.
A typical use case would be selecting a subset of related items from
other inlines, ie. images, to have some relation to other inlines.
Use as follows::
@pagles
pagles / check_versions.py
Created July 6, 2011 08:56 — forked from coordt/check_versions.py
Show local, remote and current versions of installed packages using Fabric
from __future__ import with_statement
from fabric.api import env, run, settings, hide, local
from fabric.decorators import hosts, runs_once
import os
import pip
import sys, xmlrpclib
from cStringIO import StringIO
from distutils.version import StrictVersion, LooseVersion
def _find_current_version(package, index_urls=None):
@pagles
pagles / gist:1097127
Created July 21, 2011 12:56 — forked from shun115/gist:789529
Python : pythonbrew + virtualenv 環境の構築
$ curl -kLO https://github.com/utahta/pythonbrew/raw/master/pythonbrew-install
$ chmod +x pythonbrew-install
$ ./pythonbrew-install
$ echo "source ~/.pythonbrew/etc/bashrc" >> .bashrc
$ source .bashrc
$ pythonbrew install -f 2.6.6 # なぜかtest_ioctlでこけたためforce
$ pythonbrew install -f 3.1.3 # 同上
$ pythonbrew switch 2.6.6
@pagles
pagles / es.sh
Created February 29, 2012 18:23 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get install unzip
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.0.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
@pagles
pagles / pg_stat_statements
Created January 11, 2013 14:18 — forked from troyk/pg_stat_statements
Postgres stats
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020
2) add to postgresql.conf:
shared_preload_libraries = 'pg_stat_statements' # (change requires restart)
136 pg_stat_statements.max = 1000
137 pg_stat_statements.track = all
3) restart postgres
4) check it out in psql
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select

Requirements

  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).

Usage

The git.io URL (http://git.io/vsk46) is a shortened form of the raw url of the plist.