Skip to content

Instantly share code, notes, and snippets.

View joejulian's full-sized avatar
🕶️
working without pants.

Joe Julian joejulian

🕶️
working without pants.
View GitHub Profile
@joejulian
joejulian / set_gnome-terminal_transparency.sh
Last active March 25, 2021 15:01 — forked from nirbheek/set_gnome-terminal_transparency.sh
A tiny script to set the transparency of the current X window. If "all" is specified, it tries to find all gnome-terminal windows and applies the transparency to all of them.
#!/bin/bash
# vim: set sts=4 sw=4 et tw=0 :
#
# License: BSD
: ${XWININFO:=$(type -P xwininfo)}
[[ -z ${XWININFO} ]] && { echo "You need to install xwininfo"; exit 1; }
: ${XPROP:=$(type -P xprop)}
[[ -z ${XPROP} ]] && { echo "You need to install xprop"; exit 1; }
input {
file {
path => "/var/log/glusterfs/*.log"
sincedb_path => "/var/tmp/.glusterfs.sincedb"
format => "plain"
type => "glusterfs"
}
file {
path => "/var/log/glusterfs/bricks/*.log"
sincedb_path => "/var/tmp/.glusterfs.bricks.sincedb"
@joejulian
joejulian / gist:6009570
Created July 16, 2013 15:06
Test glusterd.service
[Unit]
Description=GlusterFS an clustered file-system server
After=network.target rpcbind.service
Before=network-online.target
[Service]
Type=forking
PIDFile=/run/glusterd.pid
LimitNOFILE=65536
ExecStart=/usr/sbin/glusterd -p /run/glusterd.pid
#!/usr/bin/env ruby
require "rexml/document"
include REXML
service_document = Document.new `tools/scripts/data-deposit-api/test-service-document`
collection = XPath.first(service_document, "//collection/@href")
feed_of_studies = Document.new `tools/scripts/data-deposit-api/test-collection-get #{collection}`
first_study = XPath.first(feed_of_studies, "//entry")
id = first_study.elements["id"].text
study_edit_uri = first_study.attributes["xml:base"]
@joejulian
joejulian / server.pp
Last active December 21, 2015 08:09
Sample server
include glusterfs
@@glusterfs_peer { $fqdn: tag => 'assassinscreedonline_content', ensure => absent }
Glusterfs_peer <<| (tag == 'peergroup1') and (title != $fqdn) |>>
glusterfs::brick { '/data/gluster/aco/content/brick': host => $fqdn, tag => 'aco_c' }
glusterfs::volume { 'aco_content':
bricktag => 'aco_c',
settings => { 'nfs.disable' => 'on' }
class Meta:
queryset = Item.objects.prefetch_related('components').all()
#...
def dehydrate_quantity(self, bundle):
if len(bundle.data['components']):
qty = min([ int(x.component.quantity/x.quantity) for x in bundle.obj.components.all() ] )
bundle.data['quantity'] = qty
return bundle.data['quantity']
@joejulian
joejulian / gist:7046243
Created October 18, 2013 18:49
Failure from elasticsearch-0.90.5-1.noarch.rpm
[2013-10-18 11:44:23,935][WARN ][http.netty ] [Alibar] Caught exception while handling client http traffic, closing connection [id: 0xb7a1d1d0, /127.0.0.1:39162 => /127.0.0.1:9200]
java.lang.NoClassDefFoundError: org/elasticsearch/http/netty/NettyHttpChannel
at org.elasticsearch.http.netty.HttpRequestHandler.messageReceived(HttpRequestHandler.java:43)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:145)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.net
@joejulian
joejulian / fetchvol.py
Last active August 29, 2015 13:56
This is an example file which fetches the volfile from a GlusterFS server
#!/bin/env python
import socket
import sys
from struct import pack,unpack
SERVER='ewcs2.ewcs.com'
VOLUME='vmimages'
DEFAULT_SERVER_PORT=24007
GETSPEC=2
# /etc/init/debug.conf
start on ( starting JOB!=debug \
or started JOB!=debug \
or stopping JOB!=debug \
or stopped JOB!=debug )
script
exec 1>>/var/log/upstart.log
echo -n "$UPSTART_JOB/$UPSTART_INSTANCE ($0):$$:`date`:"
echo "Job $JOB/$INSTANCE $UPSTART_EVENTS. Environment was:"
env
@joejulian
joejulian / resize_part
Last active December 26, 2016 07:04
Python utility to maximize the root partition of a vm image for cloud-init
#! /opt/pyparted/bin/python
import parted
import os
import sys
import dbus
def ask_udisk2(mountpath):
bus = dbus.SystemBus()
udisks2obj = bus.get_object('org.freedesktop.UDisks2', '/org/freedesktop/UDisks2')