Skip to content

Instantly share code, notes, and snippets.

View drfill's full-sized avatar

Fill Quazy drfill

  • NJoyX
  • Riga, Latvia
View GitHub Profile
@edib
edib / upgrade_pg.sh
Last active October 18, 2022 04:36 — forked from ibussieres/upgrade_pg.sh
Upgrade PostgreSQL 9.3 to 9.6 on Ubuntu 16.04
sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo systemctl stop postgresql
sudo su - postgres -c '/usr/lib/postgresql/9.6/bin/pg_upgrade -b /usr/lib/postgresql/9.3/bin -B /usr/lib/postgresql/9.6/bin \
-d /var/lib/postgresql/9.3/main/ -D /var/lib/postgresql/9.6/main/ \
-O "-c config_file=/etc/postgresql/9.6/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" --link'
sudo apt-get remove postgresql-9.3 -y
@Manc
Manc / consul.service
Last active July 15, 2020 03:03 — forked from yunano/consul.service
/etc/systemd/system/consul.service
[Unit]
Description=Consul service discovery agent
Requires=network-online.target
After=network.target
[Service]
User=consul
Group=consul
PIDFile=/run/consul/consul.pid
Restart=on-failure
@msabramo
msabramo / multiple_mocks.py
Created September 11, 2015 16:12
A Python context manager for doing multiple mock.patches
@contextlib.contextmanager
def multiple_mocks(mock_specs):
"""
`mock_specs` is a dict of mock target name => mock patch kwargs
Example usage:
with multiple_mocks(
{'os.path.exists': {'side_effect': mock_path_exists},
'subprocess.Popen': {},
@bdrewery
bdrewery / bulk.sh
Last active July 6, 2018 17:37
Hook to upload packages to S3 after bulk is successful.
#! /bin/sh
#
# Copyright (c) 2013-2014 Bryan Drewery <bdrewery@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@HarryR
HarryR / eventlet-zmq-rpc.py
Last active April 1, 2017 04:01
Eventlet ZeroMQ RPC (async & sync)
import eventlet
eventlet.monkey_patch()
from eventlet.green import zmq
from eventlet.event import Event
import inspect, time
from marshal import dumps, loads
from time import time as unixtime
# http://anthon.home.xs4all.nl/Python/ordereddict/
@drfill
drfill / ocaml-gstreamer-error build
Created June 7, 2012 15:41
Unbound module Gstreamer
==> Downloading http://sourceforge.net/projects/savonet/files/liquidsoap/1.0.0/liquidsoap-1.0.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/liquidsoap-1.0.0-macosx-lion.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/liquidsoap-1.0.0-macosx-lion.tar.bz2
Liquidsoap==> ./configure --prefix=/usr/local/Cellar/liquidsoap/1.0.0-macosx-lion --with-user=test --with-group=staff --with-default-font=/Library/Fonts/Verdana.ttf --disable-ldconf
./configure --prefix=/usr/local/Cellar/liquidsoap/1.0.0-macosx-lion --with-user=test --with-group=staff --with-default-font=/Library/Fonts/Verdana.ttf --disable-ldconf
checking for a BSD-compatible install... /usr/bin/install -c
checking for GNU make... make
checking whether user test exists... ok
checking if user test belongs to group staff... ok
checking for gcc... /usr/bin/clang
@jamesdear
jamesdear / pika_native_publish.py
Created May 27, 2012 20:23
Publish 100 messages with pika twisted vs pika native
import sys
import pika
import time
pika.log.setup(color=True)
connection = None
channel = None
# Import all adapters for easier experimentation
@drfill
drfill / liquidsoap for 10.6.8
Created March 17, 2012 00:06
liquidsoap with samplerate and without lame
require 'formula'
class Liquidsoap < Formula
url 'http://sourceforge.net/projects/savonet/files/liquidsoap/1.0.0/liquidsoap-1.0.0-full.tar.bz2'
homepage 'http://savonet.sf.net/'
md5 'e379caaf68b1141b0b34bdb3db14ab69'
version '1.0.0'
depends_on 'objective-caml' => :build
depends_on 'ocaml-findlib' => :build
@chmurph2
chmurph2 / com.rabbitmq.plist
Created December 9, 2010 19:01
I created this plist in ~/Library/LaunchAgents after install RabbitMQ via Homebrew.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.rabbitmq</string>
<key>Program</key>
<string>/usr/local/sbin/rabbitmq-server</string>
<key>RunAtLoad</key>
@mnot
mnot / urlnorm.py
Created December 1, 2009 05:29
urlnorm.py: URL normalisation
#!/usr/bin/env python
"""
urlnorm.py - URL normalisation routines
urlnorm normalises a URL by;
* lowercasing the scheme and hostname
* taking out default port if present (e.g., http://www.foo.com:80/)
* collapsing the path (./, ../, etc)
* removing the last character in the hostname if it is '.'