Skip to content

Instantly share code, notes, and snippets.

@jongillies
jongillies / bash_threads.sh
Created September 22, 2012 22:47
Cheesy example of how to do "bash threads" keeping a limit on the number executing at once.
#!/bin/bash
#
# Credit goes to Pulu! http://www.linkedin.com/pub/pulu-anau/b/5b4/345
#
MAX_JOBS=5
function run_process ()
{
@jongillies
jongillies / find-svn-folders.cs
Created September 22, 2012 22:51
Example of how to find the top level SVN folder in a hierarchy of SVN repositories
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace findrepos
{
public class SVN
{
public static void Run (string command, string args)
@jongillies
jongillies / find-svn-folders.rb
Created September 22, 2012 22:52
Example of how to find the top level SVN folder in a hierarchy of SVN repositories
#!/usr/bin/env ruby
require 'rubygems'
require 'popen4'
require 'find'
def usage(message = "")
unless message.empty?
puts
@jongillies
jongillies / pauseifinide.cs
Created September 22, 2012 22:55
C# example of how to pause the process befor exist if you are in the IDE (VisualStudio)
public static void PauseIfInIDE()
{
if (System.Diagnostics.Debugger.IsAttached )
{
Console.WriteLine("Press <ENTER> to continue.");
Console.Read();
}
}
@jongillies
jongillies / Platform.cs
Created September 22, 2012 22:57
How to determine your platform in C#
using System;
namespace Supercoder.Tools
{
public class Platform
{
public static string PlatformString()
{
const string msg1 = "This is a Windows operating system.";
const string msg2 = "This is a Unix operating system.";
@jongillies
jongillies / ProcessInfo.cs
Created September 22, 2012 22:58
Find out your process filename in C#
namespace Supercoder.Tools
{
public class ProcessInfo
{
public static string MyName()
{
return(System.IO.Path.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName));
}
}
}
@jongillies
jongillies / gist:6004025
Created July 15, 2013 22:22
How can i do for create or update using the API with RocketPants (From: https://github.com/filtersquad/rocket_pants/issues/5)
class UsersController < RocketPants::Base
version 1
def index
expose User.paginate per_page: 10, page: params[:page]
end
def show
expose user
#!/usr/bin/env ruby
Payment = Struct.new(:payee, :amount, :tags)
Dateline = Struct.new(:date)
TRANSACTIONS = [
Dateline.new("2015-01-01"),
Payment.new("Milliways", 25476, "dining travel"),
Payment.new("Sirius Cybernetics", 7839),
Payment.new("Old Pink Dog Bar", 2790, "dining"),
Dateline.new("2015-01-02"),
@jongillies
jongillies / ldap.py
Created September 29, 2015 21:40
Default /etc/tower/conf.d/ldap.py
###############################################################################
# LDAP AUTHENTICATION SETTINGS
###############################################################################
# Ansible Tower can be configured to centrally use LDAP as a source for
# authentication information. When so configured, a user who logs in with
# a LDAP username and password will automatically get an account created for
# them, and they can be automatically placed into multiple organizations as
# either regular users or organization administrators. If users are created
# via an LDAP login, by default they cannot change their username, firstname,
@jongillies
jongillies / keybase.md
Created September 27, 2016 16:05
keybase.md

Keybase proof

I hereby claim:

  • I am jongillies on github.
  • I am supercoder (https://keybase.io/supercoder) on keybase.
  • I have a public key ASCoYvsqjGhtXlIAHmYT_RUadTlk03IT0CeDoEhfMJE7CQo

To claim this, I am signing this object: