Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / grub-test.sh
Created August 23, 2019 20:29
Regex Majic
#!/usr/bin/env bash
cat << EOF > grub.orig.conf
# If you change this file, run 'update-grub' afterwards to update
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
@jongillies
jongillies / create_vm.sh
Created March 9, 2017 20:07 — forked from sickbock/create_vm.sh
VirtualBox PXE boot
#!/bin/bash
cd ${myVMs}
MyVM=testvm
vboxmanage unregistervm ${MyVM} --delete
rm -rf ${MyVM}
mkdir ${MyVM}
cd ${MyVM}
vboxmanage createhd --filename ${MyVM}.vdi --size 30720
vboxmanage createvm --name ${MyVM} --ostype RedHat_64 --register
vboxmanage modifyvm ${MyVM} --memory 6172 --vram=12 --acpi on --nic1 NAT # optional second NIC # --nic2 bridged --bridgeadapter2 enp0s25
@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:

@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
@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 / 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 / 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 / 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)