Skip to content

Instantly share code, notes, and snippets.

View andypotanin's full-sized avatar
🇺🇲
Focusing

Andy Potanin andypotanin

🇺🇲
Focusing
View GitHub Profile
@aliang
aliang / Mac SSH Autocomplete
Created June 14, 2011 07:14
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@radu-gheorghe
radu-gheorghe / traffic.sh
Created November 16, 2012 14:24
bash script for checking out traffic via /proc/net/dev
#!/bin/bash
#shows traffic on the specified device
function human_readable {
VALUE=$1
BIGGIFIERS=( B K M G )
CURRENT_BIGGIFIER=0
while [ $VALUE -gt 10000 ] ;do
VALUE=$(($VALUE/1000))
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active July 7, 2024 11:25
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@justintadlock
justintadlock / register-post-type.php
Last active July 17, 2024 10:14
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
@andypotanin
andypotanin / badges-_summary.md
Last active November 21, 2017 06:25
Repository Badges

Please see repository-type specific Gists for examples.

  • All repositories should have Bug, Backlog and Active (In Progress) labels via Waffle.io to hep quickly grasp state of repository.
  • Code Quality and Climate badge should be done via either Scrutinizer (PHP) or CodeClimate (JavaScript), depending on which works better.
  • Gemnasium should be used to determine status of dependencies - it works with Composer, NPM and others.
  • CircleCI should be used in most cases, keep in mind an API token is required for each repository and must be generated in CircleCI settings. This should demonstrate if the code in the repository actually works.
  • For certain repositories custom badges (NPM, Packagist, etc.) may be used as well, when applicable.
@andypotanin
andypotanin / benchmark.php
Last active August 29, 2015 14:04
We use this to benchmark PHP in CLI.
<?php
/**
* Based off of http://www.php-benchmark-script.com/ but modified to output JSON response.
*
* wget https://gist.githubusercontent.com/andypotanin/bae0b8b40581e518e16d/raw/benchmark.php
* php benchmark.php
*
* @version 1.1.0
* @author potanin@UD
*/
## Check all response codes for Docker containers.
##
##
## source <(curl -s https://gist.githubusercontent.com/andypotanin/e1876800b56acc63c462/raw)
function app.check {
for app in $( docker ps -q -f=status=running ); do
_hostname=$(docker inspect -f '{{ .Config.Hostname }}' $app);
_domainname=$(docker inspect -f '{{ .Config.Domainname }}' $app);
@antonkorotkov
antonkorotkov / gist:e0b7f334711bc3638ced
Created April 23, 2015 15:58
LATEST DOCKER RUNNER
<?php
include_once( __DIR__ . '/vendor/autoload.php');
/**
* Get configs
*/
$configs = json_decode(file_get_contents('https://gist.githubusercontent.com/antonkorotkov/7b7bd50ff3d9ce42c48b/raw/41936ed1462aad4e5f72816ee76d86896fb0c787/gistfile1.json'));
/**