Skip to content

Instantly share code, notes, and snippets.

@tkhn
tkhn / install_node_exporter.centos6.sh
Created February 8, 2019 17:32 — forked from dale-c-anderson/install_node_exporter.centos6.sh
Install and configure Prometheus Node Exporter on a CentOS 6 box
#!/bin/bash
# Install Prometheus Node Exporter on CentOS 6.
set -eu
set -o pipefail
set -x
REPOFILE='/etc/yum.repos.d/coprs.ibotty.prometheus-exporters.repo'
INSTALLED=0
@tkhn
tkhn / encode.py
Created August 17, 2018 11:26 — forked from cameronmaske/encode.py
base64 that actually encodes URL safe (no '=' nonsense)
"""
base64's `urlsafe_b64encode` uses '=' as padding.
These are not URL safe when used in URL paramaters.
Functions below work around this to strip/add back in padding.
See:
https://docs.python.org/2/library/base64.html
https://mail.python.org/pipermail/python-bugs-list/2007-February/037195.html
"""
@tkhn
tkhn / libvips.spec
Created August 17, 2018 11:16 — forked from mbklein/libvips.spec
libvips RPM spec for CentOS 6
Summary: A fast image processing library with low memory needs
Name: vips
Version: 8.6.2
Release: 1%{?dist}
License: LGPLv2.1+
Source0: https://github.com/jcupitt/libvips/releases/download/v8.6.2/%{name}-%{version}.tar.gz
URL: https://github.com/jcupitt/libvips
BuildRequires: chrpath, gtk-doc, libxml2-devel, libjpeg-turbo-devel, libpng-devel
BuildRequires: libtiff-devel, libexif-devel, libgsf-devel, lcms-devel
BuildRequires: ImageMagick-devel, gobject-introspection-devel, libwebp-devel
@tkhn
tkhn / rem_proxmox_popup.sh
Created June 15, 2018 15:11 — forked from tavinus/rem_proxmox_popup.sh
Remove PROXMOX 5.2 subscription message popup
#!/bin/sh
#######################################################
#
# Edits the proxmox Subscription file to make it
# think that it has a Subscription.
#
# Will disable the annoying login message about
# missing subscription.
#
# Tutorial: http://mysshlog.co.uk/tutorials/Python-Simple-Dns-Server
# Source: http://mysshlog.co.uk/download/Dns_Server_Python.py
## {{{ http://code.activestate.com/recipes/491264/ (r4)
#Edited By MySSHLog.co.uk
import socket
import optparse
import time
class DNSQuery:
def __init__(self, data):
#!/bin/sh
#
# This script is used on a QNAP TS-269 PRO. https://www.en0ch.se/qnap-and-rsync/
#
# You have to change:
# 1. $SHAREUSR
# 2. $EXCLUDES (if you want o change the name of the file servername.excludes)
# 3. $SOURCE & $DESTINATION
# 4. [email protected] for the mysqldump
# 5. --password=SUPERSECRET
#!/usr/bin/perl
use strict;
$| = 1;
my %DataType = (
"TINYINT"=>1, "SMALLINT"=>2, "MEDIUMINT"=>3, "INT"=>4, "INTEGER"=>4, "BIGINT"=>8,
"FLOAT"=>'$M<=24?4:8', "DOUBLE"=>8,
"DECIMAL"=>'int(($M-$D)/9)*4+int(((($M-$D)%9)+1)/2)+int($D/9)*4+int((($D%9)+1)/2)',
"NUMERIC"=>'int(($M-$D)/9)*4+int(((($M-$D)%9)+1)/2)+int($D/9)*4+int((($D%9)+1)/2)',
"BIT"=>'($M+7)>>3',
#!/usr/bin/perl
use strict;
$| = 1;
my %DataType = (
"TINYINT"=>1, "SMALLINT"=>2, "MEDIUMINT"=>3, "INT"=>4, "INTEGER"=>4, "BIGINT"=>8,
"FLOAT"=>'$M<=24?4:8', "DOUBLE"=>8,
"DECIMAL"=>'int(($M-$D)/9)*4+int(((($M-$D)%9)+1)/2)+int($D/9)*4+int((($D%9)+1)/2)',
"NUMERIC"=>'int(($M-$D)/9)*4+int(((($M-$D)%9)+1)/2)+int($D/9)*4+int((($D%9)+1)/2)',
"BIT"=>'($M+7)>>3',
@tkhn
tkhn / get_oracle_jdk_linux_x64.sh
Created October 5, 2017 12:24 — forked from n0ts/get_oracle_jdk_x64.sh
Get latest Oracle JDK package bash shell script
#!/bin/bash
# You must accept the Oracle Binary Code License
# http://www.oracle.com/technetwork/java/javase/terms/license/index.html
# usage: get_jdk.sh <jdk_version> <ext>
# jdk_version: 8(default) or 9
# ext: rpm or tar.gz
jdk_version=${1:-8}
ext=${2:-rpm}
@tkhn
tkhn / redis-migrate.sh
Created July 31, 2017 11:25 — forked from nicStuff/redis-migrate.sh
Comfort tool for migrating redis keys among instances. Supports KEYS syntax matching, authentication and TTL
#!/bin/bash
######
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
# TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
######