Skip to content

Instantly share code, notes, and snippets.

View nicdoye's full-sized avatar
🚲
All shall be well, and all shall be well, and all manner of thing shall be well

Nic Doye nicdoye

🚲
All shall be well, and all shall be well, and all manner of thing shall be well
View GitHub Profile
@nicdoye
nicdoye / puma.sh
Created March 1, 2013 16:34
Simple startup file for individual [Puma](http://puma.io) apps on RHEL/CentOS (tested on 6.x). Just the bare minumum needed, really. Do not call it puma.sh but place a copy in for each of your puma applications. (It relies on its own name to work) By renaming it you can have as many different apps (on separate ports) as you require. You'll need …
#!/bin/sh
#
# Puma control script
#
# chkconfig: - 80 20
# description: Puma
# Create an /etc/sysconfig/file of the same name as this with the following settings
# Note this code does NOT pick any defaults, so will fall over if these are unset.
# RACK_ENV=production
@nicdoye
nicdoye / rhel6-32-bit-ruby-howto.md
Last active December 15, 2015 11:48
Compiling 32-bit ruby (MIR) on 64-bit RHEL 6

Building 32-bit ruby on 64-bit RHEL 6

Introduction

Will presumably work for many RHEL "derivatives", like CentOS, Oracle Enterprise Linux, Scientific Linux as well as "similar enough" versions of Fedora.

There is a use case for 32-bit ruby as set out in this G+ post

Set up yum

@nicdoye
nicdoye / mounts2monit.rb
Created August 30, 2013 14:45
Create basic monit config files from /proc/mounts
#!/usr/bin/env ruby
# Linux only, sorry.
#
# Look for ext[34], xfs and vxfs. Alter the regexp FILESYSTEMS for others
#
# If you have /root as a separate partition, alter the value of ROOT_USABLE
# Config
@nicdoye
nicdoye / fill_disk.sh
Created September 16, 2013 12:17
Gradually (nearly) fill a disk. Using it to test monit rules. Obviously on a real box, with other users, the disk could fill up. Caveat user.
#!/bin/bash
mountpoint=/tmp
sleeper=240
# percentage of disk used
function percentage { df $1 | tail -1 | awk '{print $4}' | tr -d % ; }
# Where we'll write
tempdir=$(mktemp -d --tmpdir=${mountpoint})
@nicdoye
nicdoye / Designer.cs
Created July 26, 2013 13:06
How to open BusinessObjects Designer XI R3.1 in C#. This is if you add Interop.DesignerX12 as a reference. If you use Interop.Designer, the package namespace is "Designer" not "DesignerX12".
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DesignerTest
{
class Program
{
@nicdoye
nicdoye / count-words.pl
Last active January 24, 2016 17:38
Perl (MOOSE) solution to the "find 3 most frequent words in a file"
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say switch);
######################################################################
package HashOfHash;
use Moose;
@nicdoye
nicdoye / quicksort.pl
Created January 27, 2016 21:14
Quicksort in Perl using Sedgewick's Medians and what I thought was an original algorithm, but turns out to be called "fat partitions" and was in Version 7 UNIX's qsort
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
########################################################################
package QS;
@nicdoye
nicdoye / how-many-steps.pl
Created January 30, 2016 12:15
Solution to question 9.1 in @gayle's "Cracking the Coding Interview" 5th ed. Child/stairs/combinations-of-steps.
#!/usr/bin/env perl
# Solution to a question in @gayle's "Cracking the Coding Interview" 5th ed.
# A child is running up the stairs and can take 1, 2 or 3 steps at a time.
# Count how many possible ways the child can run up the stairs.
use strict;
use warnings;
use Data::Dumper;
use feature qw/ say /;
@nicdoye
nicdoye / DoubleLinkedList.pl
Last active January 31, 2016 18:44
Doubly Linked List in Perl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use feature qw /say/;
package Node;
use Moose;
@nicdoye
nicdoye / list-perl-mods.sh
Created February 21, 2016 18:59
Command liner to list all perl modules installed
PERLDOC="-otext" perldoc perllocal | grep Module | awk '{print $7}'