View lc.sh
#!/bin/bash
lc() {
for i in * ; do j="$(echo $i | tr '[:upper:]' '[:lower:]' | tr ' ' '-' )" ; [ "$i" != "$j" ] && mv "$i" "$j"; done
}
View docker-java-tomcat.csv
Name Base OS Java Vendor JRE/JDK Tomcat Size (MiB)
alpine:3.7 Alpine 4
gcr.io/distroless/base distroless 16
openjdk:8-jre-alpine Alpine OpenJDK JRE 78
openjdk:8-jdk-alpine Alpine OpenJDK JDK 97
tomcat:8.5-alpine Alpine OpenJDK JRE 8.5 101
nicdoye/micro-tomcat-jre distroless OpenJDK JRE 8.5 142
nicdoye/micro-tomcat-jdk distroless OpenJDK JDK 8.5 179
tomcat:8.5-slim Debian Slim OpenJDK JRE 8.5 213
alfresco/alfresco-base-java:8 CentOS Oracle JDK 468
View docker-size.sh
docker inspect openjdk:8-jdk-alpine | jq '.[] | "\(.Size) \(.RepoTags[0])"'
View hgweb.config
[paths]
/hg/ = /srv/hg/repos/*
[web]
style = gitweb
staticurl = /hg/static
allow_push = *
View uwsgi.ini
[uwsgi]
uid = uwsgi
gid = uwsgi
pidfile = /run/uwsgi/uwsgi.pid
emperor = /etc/uwsgi.d
stats = /run/uwsgi/stats.sock
chmod-socket = 660
emperor-tyrant = true
cap = setgid,setuid
; https://www.mercurial-scm.org/wiki/PublishRepositoriesOnNginx
View nginx-hg.conf
location /hg/ {
uwsgi_pass unix:/run/uwsgi/hgweb.sock;
include uwsgi_params;
auth_basic "Mercurial repository";
auth_basic_user_file /etc/nginx/htpasswd;
client_max_body_size 0;
}
View time.sh
# Contains a rounding error, but we didn't need the accuracy
# Check if $response is an empty string or not a number
if [ -z ${response} ] || [ $(( ${response} + 0 )) == 0 ]
then
mins=undef
secs=undef
then
else
mins=$(( ${response} / 1000 / 60 ))
secs=$(( ${response} / 1000 - 60 * ${mins} ))
View my_date.sh
my_date () {
local date_cmd
local date
# Check if GNU date installed as gdate
: type gdate 2> /dev/null
[ $? == 0 ] && date_cmd=gdate || date_cmd=date
# Attempt GNU date - date will be unset if this fails
date=$(${date_cmd} --iso-8601=second 2> /dev/null)
View get-ip.pl
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/say/;
use WebService::IFConfig::Client;
my $client = WebService::IFConfig::Client->new();
say $client->get_ip;'
View IntegerDivision.pm
package Math::IntegerDivision;
use Carp;
use Moose;
has 'numerator' => (
is => 'rw',
isa => 'Int'
);