This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class ProducerConsumer | |
def initialize producers = 5, consumers = 5, queue_size = 5 | |
@producers, @consumers = producers, consumers | |
@queue = SizedQueue.new queue_size | |
@mutex = Mutex.new | |
@threads = [] | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stick this in lib/tasks/assets.rake or similar | |
# | |
# A bug was introduced in rails in 7f1a666d causing the whole application cache | |
# to be cleared everytime a precompile is run, but it is not neccesary and just | |
# slows down precompiling. | |
# | |
# Secondary consequences are the clearing of the whole cache, which if using | |
# the default file cache could cause an application level performance hit. | |
# | |
# This is already fixed in sprockets-rails for rails 4, but we patch here for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASH function to get the result | |
# of a ^ b when a, b are in the | |
# following hexadecimal string | |
# form: AF396463D8705 ... | |
# Obtained from here: | |
# http://www.codeproject.com/Tips/470308/XOR-Hex-Strings-in-Linux-Shell-Script | |
# Author is Sanjay1982 (see http://www.codeproject.com/Members/Sanjay1982) | |
# Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /etc/polkit-1/rules.d/10-rules.rules | |
// PolKit rules to allow mounting, rebooting and network management without a password. | |
// User needs to be in storage, power and network groups. | |
polkit.addRule(function(action, subject) { | |
if (action.id.match("org.freedesktop.udisks2.") && subject.isInGroup("storage")) { | |
return polkit.Result.YES; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>de.ring0.lhw</groupId> | |
<artifactId>system</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<dependencies> | |
<dependency> | |
<groupId>com.almworks.sqlite4java</groupId> | |
<artifactId>sqlite4java</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create external table aws_billing( | |
InvoiceId string, | |
PayerAccountId string, | |
LinkedAccountId string, | |
RecordType string, | |
RecordID int, | |
BillingPeriodStartDate string, | |
BillingPeriodEndDate string, | |
InvoiceDate string, | |
PayerAccountName string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 19cc3b567644 make/sun/font/Makefile | |
--- a/make/sun/font/Makefile Wed Jan 22 12:34:24 2014 -0800 | |
+++ b/make/sun/font/Makefile Fri Jan 24 21:41:23 2014 +0900 | |
@@ -138,7 +138,7 @@ | |
ifeq ($(USING_SYSTEM_FT_LIB), false) | |
FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6 | |
endif | |
- OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype | |
+ OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype -lfontconfig | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Compress MySQL tables on disk. | |
# Author: Andrew Berry, andrew.berry@lullabot.com | |
# | |
# Compress all tables in a MySQL InnoDB database using compression from the | |
# Barracuda table format. Tables have to already be in the Barracuda file | |
# format to actually compress tables, otherwise the table setting is ignored. | |
# | |
# innodb_file_per_table = 1 MUST be set in my.cnf for compression to work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# A simply utility to show character counts for each line of input and | |
# highlight lines longer than 80 characters. | |
# | |
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
# | |
# Examples: | |
# | |
# $ hilong Gemfile |