Skip to content

Instantly share code, notes, and snippets.

View israelshirk's full-sized avatar

Israel israelshirk

View GitHub Profile
@israelshirk
israelshirk / gist:7242824
Created October 31, 2013 00:50
Fedora 19 basic server install
yum -y install etckeeper
yum -y remove sendmail
yum -y groupinstall "Development Tools"
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
vim /etc/yum.repos.d/Percona.repo
yum -y install nfs-utils gpg etckeeper nginx php php-fpm php-pecl-imagick composer php-oauth php-magickwand php-pecl-imagick php-pecl-apc php-pear-PHP-CodeSniffer php-pecl-cairo php-pecl-igbinary php-pecl-mongo php-pecl-xdebug php-zmq php-gd php-gmp php-mcrypt php-mysqlnd php-pdo php-pecl-memcache php-pecl-memcached php-pecl-geoip php-process php-soap varnish openssl python3 python-pip python3-pip gpg perl-Data-Dumper screen telnet redhat-rpm-config cracklib libc libstdc glibc glibc-devel glibc-headers postfix memcached redis Percona-Server-server-56 Percona-Server-client-56
@israelshirk
israelshirk / gist:7593634
Created November 22, 2013 02:09
Batch updates wordpress plugins from SVN
export BASEPATH=/var/web/vhosts/
export SVNPATH=/var/web/wordpress-plugins/
# Don't modify after this point.
export CONTENT_DIRS=`find ${BASEPATH} -name wp-content`
export PLUGIN_DIRS=`find ${CONTENT_DIRS} -maxdepth 1 -mindepth 1 -type d -name plugins`
export PLUGIN_FOLDERS=`find ${PLUGIN_DIRS} -maxdepth 1 -mindepth 1 -type d`
export PLUGIN_NAMES=`echo ${PLUGIN_FOLDERS} | xargs -n 1 basename | sort | uniq -u`
export OLD_PLUGIN_DATE=`date +%s`
#!/usr/bin/python
# -*- coding: utf-8 -*-
# launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
# launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
from twisted.internet import reactor, stdio, defer
from twisted.internet.protocol import Protocol, Factory
from twisted.protocols.basic import LineReceiver
import time, re, math, json
#!/usr/bin/python
# -*- coding: utf-8 -*-
# launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
# launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
from twisted.internet import reactor, stdio, defer
from twisted.internet.protocol import Protocol, Factory
from twisted.protocols.basic import LineReceiver
import time, re, math, json
# Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs
# fallback to google or any other DNS server to resolv domains not present on Redis
# to set a new domain on redis, just issue a SET domain.tld ip_addr
# run with twistd -ny txredns.tac
# gleicon 2011
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
for f in `find`; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'`; done
#!/usr/bin/env php
<?php
/*
Copyright 2013 Stuart Carnie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@israelshirk
israelshirk / gist:7816367
Created December 5, 2013 23:59
Restart mysql slave
pt-slave-restart --user=user --verbose --ask-pass --host=127.0.0.1 --error-text="something unique to the expected error"
@israelshirk
israelshirk / gist:7816443
Created December 6, 2013 00:07
pt-archiver
pt-archiver --user USER --password PASSWORD --no-check-charset --host=127.0.0.1 --file '/PATH/TABLE_%Y-%m-%d-%D.%t' --for-update --check-slave-lag h=HOST,u=USER,p=PASSWORD --source D=DATABASE,t=TABLE --where 'modified <= DATE_SUB(NOW(), INTERVAL 4 WEEK)'
@israelshirk
israelshirk / make_chroot_jail.sh
Last active December 31, 2015 14:09
Chroot script for Fedora 19 - PHP-FPM + nginx. Minor modifications due to some libs not getting found, tries to use hard links instead of copying (when possible), and Fedora symlinking /lib64 and /lib to /usr/lib64 and /usr/lib, respectively.
#!/bin/sh
#
# (c) Copyright by Wolfgang Fuschlberger...
# Cheaply hacked as a proof of concept by Israel Shirk, December 2013.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#