Skip to content

Instantly share code, notes, and snippets.

David Pennington Xeoncross

Block or report user

Report or block Xeoncross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Xeoncross
Xeoncross / default.loc
Last active Feb 24, 2019
default nginx + php-fastcgi vhost (win/linux)
View default.loc
# 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)$ {
View iptables.up.rules
*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
View php-fastcgi.sh
#!/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
View snippets.conf
[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%
View filetypes.xml
# 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 Sep 14, 2010
Creating/Adding SSH key
View ssh.key.sh
## 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 Sep 17, 2010
Work with files over SSH
View mysql.ssh.tunnel.bashrc
# 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 Sep 17, 2010
Install mysql workbench
View mysqlworkbench.sh
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)
View array.php
<?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)
{
View ignore.files.svn
# 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 .*
You can’t perform that action at this time.