Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@xeoncross
xeoncross / default.loc
Last active December 6, 2020 18:34
default nginx + php-fastcgi vhost (win/linux)
# Creates unlimited ".loc" domains as long as you add the
# entry to /etc/hosts and create the matching $host folder
server {
listen 80 default;
server_name _;
root /home/user/www/$host;
index index.html index.php;
# Directives to send expires headers and turn off 404 error logging.
#location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
*filter
# http://articles.slicehost.com/2010/4/30/ubuntu-lucid-setup-part-1
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
[PHP]
# Geany snippet config
# Little php snippets written by Atanas Beloborodov <nasko@cod3r.org>
# Some php5 object`s usefull snippets
class=class %cursor% \n{\n\tpublic function __construct()\n\t{\t\n\n\t}\n\n\tpublic function __destruct()\n\t{\t\n\n\t}\n}
interface=interface %cursor% %block%
static=public static function %cursor%() %block%
public=public function %cursor%()%block%
protected=protected function %cursor%()%block%
private=private function %cursor%()%block%
# My Geany PHP color http://geany.pdarko.co.cc/filetypes/index.php?edit=filetypes.xml
php_default=0x000000;0xffffff;false;false
php_simplestring=0x0d6906;0xffffff;false;false
php_hstring=0x0d6906;0xffffff;false;false
php_number=0x606000;0xffffff;false;false
php_word=0x8c0101;0xffffff;false;false
php_variable=0x2c1496;0xffffff;false;false
php_comment=0xa6a08b;0xffffff;false;false
php_commentline=0xa6a08b;0xffffff;false;false
php_operator=0x5c5e63;0xffffff;false;false
@xeoncross
xeoncross / ssh.key.sh
Created September 14, 2010 16:58
Creating/Adding SSH key
## add your public key to a new server
ssh-copy-id -i ~/.ssh/id_rsa.pub USERNAME@exammple.com
# new key
scp ~/.ssh/id_rsa.pub user@hostname:~/.ssh/authorized_keys
ssh user@hostname
cd .ssh
chmod 600 authorized_keys
@xeoncross
xeoncross / mysql.ssh.tunnel.bashrc
Created September 17, 2010 16:42
Work with files over SSH
# Forward all traffic on localhost port 3333 to MySQL on the remotehost
ssh user@remotehost -L 3333:127.0.0.1:3306
# or add it to .bashrc
alias remote_db='ssh user@remotehost -L 3333:127.0.0.1:3306'
# Copy a directory to another machine using SSH
rsync -a -e --delete ssh source/ username@remotemachine.com:/path/to/destination/
# If a file was originally in both source/ and destination/ (from an earlier rsync, for example),
@xeoncross
xeoncross / mysqlworkbench.sh
Created September 17, 2010 16:52
Install mysql workbench
1) Download the ubuntu package from the MySQL web site (http://dev.mysql.com/downloads/workbench/)
2) cd into that directory where the ".deb" package is
3) sudo apt-get install libctemplate0 libzip1 python-pysqlite2 mysql-client python-crypto python-paramiko
4) sudo dpkg -i mysql-workbench-gpl-5.2.27-1ubu1004-amd64.deb (or whatever your package name is)
<?php
$array_1 = array('zero', 'two', 'three', 'five');
$array_2 = array('one', 'three', 'four','six','eight', 'nine');
$array_3 = array('one', 'four', 'five', 'six','seven', 'eight');
$array_4 = array('zero', 'four', 'five', 'eight', 'nine');
// All elements missing from one array that are present in the other
function array_diff2($a,$b)
{
# at the command line
svn propedit svn:ignore ./some_path
# Then add * to the file that is opened to ignore all files in that directory
# You can also do things like *.class.php or .*