Skip to content

Instantly share code, notes, and snippets.

View fgimian's full-sized avatar

Fotis Gimian fgimian

View GitHub Profile
@fgimian
fgimian / test-ping.sh
Last active November 21, 2016 08:16
A simple little script to run on macOS to test stability of your internet connection
#!/bin/bash
# Set the destination IP or hostname to ping
DESTINATION=8.8.8.9
# Ping the endpoint and write an error to a log file if the ping fails 5 times consecutively
FAILURE_COUNT=0
while true
do
ping -c 1 -t 1 $DESTINATION > /dev/null 2>&1
@fgimian
fgimian / satellite.py
Created August 21, 2016 23:35
Red Hat Satellite Dynamic Inventory for Ansible
#!/usr/bin/env python
#
# Red Hat Satellite Dynamic Inventory for Ansible
# Copyright 2016 by Fotis Gimian (MIT License)
#
# Set your inventory to point to this script and ensure the script is
# executable. You'll need an INI file with Satellite details of the following
# style (whereby you may specify one or more Satellite servers):
#
# [satellite]
#!/usr/bin/env python
from __future__ import print_function
from glob import glob
import multiprocessing
import os
import signal
import subprocess
import sys
@fgimian
fgimian / virtualenvwrapper_autoswitch.sh
Created August 4, 2015 13:42
Automatic virtualenv switching for virtualenvwrapper
# Automatic activation and deactivation of virtualenvs using virtualenvwrapper
# whereby the virtualenv name must match the current directory name
function cd
{
# Perform the regular cd
builtin cd "$@"
# Iterate through the current directory, heading into each parent directory
# until we find a .virtualenv file or land in the top directory (/)
test_directory=$(pwd)
@fgimian
fgimian / terminal.js
Last active June 16, 2016 22:55
Setting up the Terminal with JavaScript on OS X Yosemite
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
// Obtain the terminal application
terminal = Application('Terminal');
// Set the font
terminal.defaultSettings.fontName = 'Source Code Pro for Powerline';
terminal.defaultSettings.fontSize = 18;
terminal.defaultSettings.fontAntialiasing = true;