Skip to content

Instantly share code, notes, and snippets.

View chales's full-sized avatar

Chris Hales chales

View GitHub Profile
@chales
chales / bbedit-pretty-json-readme.txt
Last active April 26, 2024 20:55
Make JSON legible with BBEdit
2016/03/15
Tested with BBEdit 11.5 / OS X 10.11.3 / Python 2.7.10
http://grokin.gs/blog/elegant-json-pretty-print-for-bbedit/
Place the script (or a link to this script) in the ~/Library/Application Support/BBEdit/Text Filters directory
Restart BBEdit.
The new filter should be under: "Test > Apply Text Filter > bbedit-pretty-json"
@chales
chales / db-connect-test.php
Last active June 3, 2023 01:01
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@chales
chales / jenkins-slave
Created October 29, 2017 23:19 — forked from jacksoncage/jenkins-slave
Bash script to check if a Jenkins slave node is offline and will restart node java process.
#!/bin/sh
#
# jenkins-slave: Launch a Jenkins BuildSlave instance on this node
#
# chkconfig: - 99 01
# description: Enable this node to fulfill build jobs
#
JENKINS_WORKDIR="/var/jenkins"
JENKINS_USER="jenkins"
@chales
chales / sed cheatsheet
Last active January 3, 2023 13:57 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@chales
chales / ssh-config
Last active September 29, 2022 00:53
SSH Config - Sample file to show staff the common options to add to your '~/.ssh/config' file. This is just a text file and should have the same perms as the other files in ~/.ssh, usually 600 (read and write by user only).
#### Example SSH config file
# Host = a list of domains, IPs and personalized aliases that use this config
# entry. These alias names follow "Host" and are space delimited.
# e.g. Host 192.168.1.1 example.com example1 myalias1
# Hostname = the IP or real hostname
# e.g. Hostname 192.168.1.1
# User = the username
# e.g. User jdoe
# Port = if this is a non standard port, i.e. not 22
@chales
chales / Mavericks-usb.txt
Created April 13, 2014 23:57
Creating an OS X 10.9.X Mavericks bootable installation on a USB flash drive.
Download a copy of Mavericks from the Apple Store. It will save in your /Applications directory and will open once the download is complete. Just quit the installation. If you run the installer it will delete itself so move it to keep a copy.
Format an 8G+ (needs about 6G of space) USB stick with the 'Mac OS X Extended Journaled' format and leave it named 'Untitled' but be sure that you do not have another volume named "Untitled" or the next step could erase something!
Open the Terminal app and run the following command. This copies the resources over to the USB stick and makes it a bootable drive. Check the path, if you moved the file correct the paths.
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
You should see something like the following, the "Copying installer files..." will take about 20 minutes with not progress indication. Just wait for it.
@chales
chales / cache-warmer-3.sh
Last active January 19, 2022 14:01
A couple of simple options to parse sitemap.xml to warm the cache or for other actions such as generating memory_profiler checks.
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so
# that it automatically executes when the cron run completes.
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1
@chales
chales / base-d6.aliases.drushrc.php
Last active October 28, 2021 20:58
Drush aliases full featured base file for Local, Staging, Development and Production environments such as an Acquia or Pantheon hosted site. In this version the "structure-tables" array is setup for a Drupal 6 set of core tables and common contrib module tables (CCK and Views). You should modify the array and add or remove tables to match your b…
<?php
/**
* Setup This File:
* Look for strings wrapped in { } and update them to match your environments.
* e.g. {project-short-name} is the abreviation name to replace throughout.
*/
/**
* Site aliases for {project-short-name}
@chales
chales / README.md
Last active July 25, 2021 05:38
Helper bash functions to retrieve info and login to AWS EC2 instances.

You must install the AWS CLI to use these functions. You also have to have access keys to AWS and permission to access instance information.

The AWS CLI install is usually painless, see http://docs.aws.amazon.com/cli/latest/userguide/installing.html

sudo easy_install pip

sudo pip install awscli

After install run the setup to set your configuration options which includes the default region and your access keys.

@chales
chales / jenkins-plugins.md
Created October 7, 2020 14:01 — forked from noqcks/jenkins-plugins.md
How to get a complete plugin list from jenkins (with version)

I need a way to get a list of plugins so that I can use them with docker jenkins in the format <plugin>: <version>

1. get the jenkins cli.

The jenkins CLI will allow us to interact with our jenkins server from the command line. We can get it with a simple curl call.

curl 'localhost:8080/jnlpJars/jenkins-cli.jar' > jenkins-cli.jar