Skip to content

Instantly share code, notes, and snippets.

@tomfanning
tomfanning / resolve-mongodb-warnings.sh
Last active December 11, 2016 20:24
Fix mongodb startup warnings on RHEL
# run once
sed -i -e '/^readahead=/s/^.*$/readahead=32/' /usr/lib/tuned/throughput-performance/tuned.conf
echo "mongod soft nproc 64000" > /etc/security/limits.d/90-nproc.conf
echo '#!/bin/sh -e
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled' > /usr/local/sbin/mongodb-prep.sh
chmod +x /usr/local/sbin/mongodb-prep.sh
echo '[Unit]
Description=mongodb prep
Before=mongod.service
@tomfanning
tomfanning / start-mprime.sh
Created November 15, 2016 09:53
mprime / prime95 for linux
mkdir mprime
pushd mprime
wget http://www.mersenne.org/ftp_root/gimps/p95v2810.linux64.tar.gz
tar zxfv p95v2810.linux64.tar.gz
popd
./mprime/mprime -m
@tomfanning
tomfanning / cloud-init non-cloud static IP.txt
Created September 12, 2016 20:09
cloud-init non-cloud static IP
#meta-data:
instance-id: hostname
network-interfaces: |
auto eth0
iface eth0 inet static
address 192.168.1.34
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
set PGUSER=postgres
set PGPASSWORD=xxx
set OUTPUTPATH=e:\myfile.backup
set DB=whatever
set HOST=whatever
pg_dump -h %HOST% -p 5432 -U %PGUSER% -F c -b -v -f %OUTPUTPATH% %DB%
rem TCP port to unblock is 5432
echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
@tomfanning
tomfanning / gist:382cbf0bbfe5b9124cc12ebeab1c4cd1
Created May 17, 2016 13:08
Batch file to run command line jmeter tests
del results.jtl
pushd C:\Users\Administrator\Desktop\apache-jmeter-2.13\bin
call jmeter.bat -n -t ..\..\jmeter-results\test-plan.jmx
popd
pause
@tomfanning
tomfanning / jmeter.bat
Created May 17, 2016 13:07
jmeter.bat with greatly raised memory limits
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
@tomfanning
tomfanning / Backup-VMs.ps1
Last active March 23, 2019 02:20
Backup Hyper-V VMs using save-vm, export-vm, result-vm with basic rotation
$ErrorActionPreference = "Stop"
# https://gist.github.com/tomfanning/617bde27596de3b1ca62
$backuptarget = "b:\HyperV"
$compression = $false
$VMs = Get-VM
foreach ($vm in $vms){
@tomfanning
tomfanning / gist:7dae3494e01ed9732b25
Last active February 15, 2016 13:56
Hyper-V additions for Ubuntu
#apt-get install --install-recommends linux-tools-virtual-lts-vivid linux-cloud-tools-virtual-lts-vivid
apt-get install hv-kvp-daemon-init
linux-virtual?
linux-cloud-tools-virtual
linux-tools-virtual
$ErrorActionPreference = "Stop"
# run the script in an elevated Powershell like this:
# iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/tomfanning/f75f6a808a9265b48af0/raw/'))
#todo: - install windows photo viewer, make it the default
# - unpin the remaining crud from the start menu
function Set-RegValue
{
Dell Poweredge 1855 1955 PSU AHF-2DC 2100W (12v 175A) Pinout.
Works on 220-240v only.
Is compatible with US home type split-phase 220VAC but be cautious as to the correct wiring of the plug.
All of the important pins are included.
Connect PS On (A5) and PS Kill (B3) to ground to power up.
A5 = PS On
B3 = PS Kill