Skip to content

Instantly share code, notes, and snippets.

View gjedeer's full-sized avatar
💭
Fucking kittens

GDR! gjedeer

💭
Fucking kittens
View GitHub Profile
#!/bin/bash
echo nameserver 8.8.8.8 >> /etc/resolv.conf
mkdir .ssh
echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAp+PYBtN0SlupDT6NxpNSxi97+Z0ETahZXIoeXWoSuiGmeanU/5bf84RE0vhzu494s6hfhgHOOAJL6z2lBr4qNDvdcdv6asNrQjO2r2bnb6W/hogun6usL6D0twujIH60QQqAK8ommRd5X/kSD2vOugShJchfsRMRPWcwkNjJctP5BXJ0kBwP4iylatxro93gMyN6M0Hanbe2UlMkEmwF3qHJTl3EJcQC4rR0VzX1dybpxS+UaX0nV0I5EX6CWSdrg5gqH9GvhbUg7aIHBZqH3ACrrO1betudHKaFKt5wCSaSWqHemBGnYTm0cjKjxIWL2eB7aSaSJJVIy5pC7Aa1dw== root@mx1.cloudaccess.net > .ssh/authorized_keys
echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAztvVNmwC+KuYQXf6mBIye6cuFzjme3iZEMLWUgoQCGboKfS/5q5c7Liwvu/Wn59BYXDNFY4zs/gyuqJFJ/xvc0lycDE7UGfEbC811Kah3bgPOM6CfHHJRXpVKsb178VImBN8eEwKlf9kZKuvrIP/KaxVbP9O1DAlP48MLYrg5Lc= andrew@cloudaccess.net >> .ssh/authorized_keys
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum -y install vim-enhanced nano mc subversion python26* sysstat nmap nc htop iftop
#!/bin/bash
# turn off some services not needed
chkconfig kudzu off
chkconfig mcstrans off
chkconfig restorecond off
chkconfig netfs off
chkconfig gpm off
#!/bin/bash
# turn off some services not needed
chkconfig kudzu off
chkconfig mcstrans off
chkconfig restorecond off
chkconfig netfs off
chkconfig gpm off
@gjedeer
gjedeer / chown_by_name.py
Created August 23, 2011 06:22
Change file owner user/group by either username/groupname or numeric ID
#!/usr/bin/python
import os
import pwd
import grp
def chown_by_name(path, user, group = None):
"""Chowns file based on username and groupname
If group name is left blank, group is preserved
"""
@gjedeer
gjedeer / nag_send_xmpp
Created October 10, 2011 19:55
Nagios + XMPP (Jabber) notifications
#!/usr/bin/python
"""
Use either Nagios env variables or command line args
and send jabber message using sendxmpp
by GDR!
Fill in contact's PAGER to his JID, and add the following command:
define command {
from django.forms import widgets
from itertools import chain
from django.utils.encoding import StrAndUnicode, force_unicode
from django.utils.html import escape, conditional_escape
from django.utils.safestring import mark_safe
class CheckboxSelectMultiple(widgets.SelectMultiple):
def render(self, name, value, attrs=None, choices=()):
if value is None: value = []
has_id = attrs and 'id' in attrs
@gjedeer
gjedeer / logging_wrapper.py
Created March 7, 2012 18:51
Logging wrapper for any command
#!/usr/bin/python
#
# Some command in the system being called in mysterious conditions?
# Use the logging wrapper!
# It will log all calls of a command along with process tree
# ("stack trace" of all calling processes)
#
# Usage:
# pip install psutil
# mv /usr/bin/snoopedcommand /usr/bin/snoopedcommand_wrapped
@gjedeer
gjedeer / gist:3422797
Created August 22, 2012 06:14
Mass-change database prefixes in Joomla!
#!/bin/bash
#
# mass change prefixes in Joomla database
# massivescale.net 2012
#
echo "SELECT concat('rename table ', table_name, ' to ', 'iddqd', substr(table_name,4), ';') FROM information_schema.tables WHERE table_name like 'jos%';" | mysql | tail -n +2 | mysql `grep db\ /var/www/configuration.php | awk -F"'" '{print $2}'`
sed -i -e 's/jos_/iddqd_/' /var/www/configuration.php
@gjedeer
gjedeer / gist:4136492
Created November 23, 2012 17:06
Add noatime option to fstab for all ext* filesystems
#!/bin/bash
#
# Add noatime option to fstab for all ext* filesystems
#
sed -i -r 's/(ext[2-4]\s+)defaults\s/\1defaults,noatime /g' /etc/fstab
@gjedeer
gjedeer / gist:4514423
Created January 11, 2013 22:14
Rails with configurable socket path
#!/usr/bin/env ruby
# Run me from scripts/
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
require 'ruby_version_check'
require 'initializer'
require 'dispatcher'