Skip to content

Instantly share code, notes, and snippets.

@UKNC
UKNC / oom-warner.sh
Created February 26, 2018 11:29
OOM warner script
#!/bin/bash
# Run from ~/.bashrc as
# if pgrep oom-warner > /dev/null; then
# echo oom-warner already running, exiting...
# else
# nohup ~/bin/oom-warner.sh &
# fi
@UKNC
UKNC / StrongWeakStaticDynamicTyping.md
Last active September 29, 2017 08:02
Statically/Dynamically typed and Strongly/Weakly typed languages
Strongly typed Weakly typed
Dynamically typed Python Perl, JavaScript
Statically typed C, C++, Java NA
@UKNC
UKNC / masscopyid.pl
Last active April 29, 2017 10:05
Automate ssh-copy-id
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my $pwdfile;
GetOptions( "file=s" => \$pwdfile ) or die "Error in cmd args";
if ( !$pwdfile ) {
#!/bin/bash
hosts=(nqpc001 nqpc002 nqpc003 drft045 localhost "127.0.0.1")
for h in ${hosts[@]}; do
result=$(ping -c 2 -W 1 -q $h | grep transmitted)
pattern="0 received";
if [[ $result =~ $pattern ]]; then
echo "$h is down"
else
echo "$h is up"
@UKNC
UKNC / package.json
Last active March 5, 2017 11:33
Showcase for unsupported gzip decompression in phantom-nodejs
{
"name": "phantomgzip",
"version": "1.0.0",
"description": "Showcase of inability to support gzip",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "UKNC",
"license": "ISC",
@UKNC
UKNC / findUnusedPorts.pl
Created February 2, 2017 11:39
Determines range of ephemeral ports and number of unused ports.
#!/usr/bin/perl
#################################################################################
# Author: NQPC
# Description: determines range of ephemeral ports and number of unused ports
# OS: CentOS
##################################################################################
use strict;
use warnings;
@UKNC
UKNC / Install httperf from source on CentOS 6.md
Last active November 4, 2016 11:48
Install httperf from source on CentOS 6

Get and unzip source

wget https://github.com/httperf/httperf/archive/master.zip
unzip master.zip
cd httperf-master

Change ulimit -n

@UKNC
UKNC / Install headless Firefox on CentOS 6 for Selenium automation.md
Last active May 5, 2023 15:06
Install headless Firefox on CentOS 6 for Selenium automation

Abstract

In the manual the steps required to install headless Firefox on CentOS 6 are described. Headless Firefox may be needed to perform GUI automated testing.

All steps of this manual have been validated on CentOS 6.8. It should not be a problem to adapt the solution to other distros.

Steps

Upgrade yum