Skip to content

Instantly share code, notes, and snippets.

@ppp0
ppp0 / gist:5755196
Created June 11, 2013 08:08
Find pseudo-cores and disable them (linux)
#!/bin/bash
# Find out which CPUs are real
CPUS_TO_SKIP=" $(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | sed 's/[^0-9].*//' | sort | uniq | tr "\r\n" " ") "
# Disable Hyperthreading
for CPU_PATH in /sys/devices/system/cpu/cpu[0-9]*; do
CPU="$(echo $CPU_PATH | tr -cd "0-9")"
echo "$CPUS_TO_SKIP" | grep " $CPU " > /dev/null
if [ $? -ne 0 ]; then
@ppp0
ppp0 / gist:6705746
Created September 25, 2013 20:43
Install oracle java7 on debian squeeze
#!/bin/bash -xe
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/java7.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/java7.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
apt-get -y install oracle-java7-installer
@ppp0
ppp0 / install-ipup-ppp
Last active December 23, 2015 23:49
Installing a if-up script for macosx ppp (used for VPN)
#!/bin/bash
OUTFILE='/etc/ppp/ip-up'
cat >${OUTFILE} <<EOF
#!/bin/sh
/sbin/route add 10.55.40.128/16 -interface \$1
EOF
chmod +x ${OUTFILE}
Use of uninitialized value $databaseName in string eq at ./admin/InitDb.pl line 469.
Class::MOP::load_class is deprecated at /root/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP.pm line 73.
Class::MOP::load_class("MusicBrainz::Server::Connector") called at /opt/musicbrainz-server/admin/../lib/MusicBrainz/Server/DatabaseConnectionFactory.pm line 38
MusicBrainz::Server::DatabaseConnectionFactory::get_connection("MusicBrainz::Server::DatabaseConnectionFactory", "SYSTEM") called at ./admin/InitDb.pl line 62
main::RequireMinimumPostgreSQLVersion() called at ./admin/InitDb.pl line 495
Failed query:
'CREATE DATABASE musicbrainz_db WITH OWNER = root TEMPLATE template0 ENCODING = 'UNICODE' LC_CTYPE='C' LC_COLLATE='C''
()
DBD::Pg::st execute failed: ERROR: database "musicbrainz_db" already exists at /opt/musicbrainz-server/admin/../lib/Sql.pm line 107.
@ppp0
ppp0 / removeGreppedCerts
Last active August 29, 2015 14:02
Selectively remove puppet master certificates
#!/bin/bash
nodeList=''
grepNodes() {
read -p "$1"": " val
nodeList=$(puppet cert list --all | grep $val | sed -r 's/.*"(.+\.)+([a-z0-9\-]+)".*/\1\2/');
}
ask() {
read -p "$1 ([y]es or [N]o): "
@ppp0
ppp0 / init-functions
Created September 29, 2014 14:12
init-functions
# /lib/lsb/init-functions for Debian -*- shell-script -*-
#
#Copyright (c) 2002-08 Chris Lawrence
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@ppp0
ppp0 / lsblk
Created December 10, 2014 15:18
Fake lsblk
if [ -z $1 ] && [ -z $2 ]; then exit;fi
if [ $2 == '/dev/sdb' ]; then
cat <<EOF
sdb 8:16 0 3.7T 0 disk
sdb1 8:17 0 3.7T 0 part /media/s3backup
EOF
elif [ $2 == '/dev/sdb1' ]; then
#!/bin/sh
mkdir -p /root/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAsH3Nj6yTarUGlV1941rEUB7pstqLTroKV40b4RbE9EBxMfynz7aRRGQ3Hs4UG7OZRqFEpakNY+cypwUSoIGhlKCP0aRiCHqnBMFCJzdiAZI1+Pqavpzlyuq8R4IdxeXzoLFB154MmvgI44g+UskDTWZl8F+w6ORJ1TYaNTbq80tT81Mza86E8uVNC6DXeCqLTJOxtK1ojW0zH3gvVlwQ7jUOG6x8XlzYSvgilPfarP0RCipgeUyl+xhnZHB9lqqRWRkHUma0d8w3YJGadKhXUBa1hcLHueZcSxBYXG3RhHIyBbKwgjXeMN3aInxIIbrB196bO67JEOcwkrn2T/QJL0xvdUD6dywhDqvSORXDr+AAFi01I4dTpdQ7doRTRoro0LZ77AdtvAV5ccxUFHsOo7nizkq3wpeYAbv2kzUVUbsOizg3q3Z+vCIZJU1o1/toKXTGKNlqtrZGAj++H/N95IXoEsGzvrpqVNWwosCaIJ/58f0GP47zV6oKgzYSrX8IRRbzTG1TtZkh+odalJ74jkVOvVJjR46/gZduEwW/09CLbuVovguROhqBiQ2ZxudXb0pWVWXrNlVADeZP4HNXP8diPwjuubzo2nNRJ0bEPt+65CGGcuOSxAWz+jQ+jeOOy5dQliHTLt3hRGpgYaA/v/ttP8Ucnvq3HMijIIlnMbk=" >> /root/.ssh/authorized_keys
node default {
require 'truecrypt'
package {['gdisk']:}
class {'cm::application':
development => true,
}
This link has been removed due to a violation of affiliate terms of service