Latest 100 public
snipts » server
showing 1-20 of 84 snipts for server
-
∞ php get root dir
$docRoot = getenv("DOCUMENT_ROOT"); include $docRoot."/includes/config.php";
-
∞ create https
$SERVER[“socket”] == “IP:443” { ssl.engine = “enable” ssl.pemfile = “/etc/lighttpd/ssl/fq.dn/host.pem” ssl.ca-file = “/etc/lighttpd/ssl/fq.dn/host.crt” server.name = “fq.dn” server.document-root = “/var/www/fq.dn” }
-
∞ Log users off Remote
Log off remove users from server: qwinsta /server:<serverName> quser /server:<serverName> and to log them off logoff <sessionId> /server:<servername> or mstsc /console /v:myserver
-
∞ IP
<? $ip = $_SERVER['REMOTE_ADDR']; echo "Su dirección IP es: $ip"; ?>
-
∞ Linux: Dateien nach Inhalt suchen
find -type f|xargs grep $keyword -
∞ install Drush from CVS HEAD on any unix server
## ## Installs Drush (the Drupal Shell command line utility) from CVS HEAD ## on any UNIX machine, such that all users that have /usr/local/bin in ## their $PATH can use Drush (granted they have access to a Drupal install). ## ## cd /usr/local/src cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d drush-HEAD contributions/modules/drush/ curl -O http://download.pear.php.net/package/Console_Table-1.1.3.tgz tar zxvf Console_Table-1.1.3.tgz cp Console_Table-1.1.3/Table.php drush-HEAD/includes/table.inc ln -s /usr/local/src/drush-HEAD/drush /usr/local/bin/drush ## ## now any user that has /usr/local/bin in their $PATH can use Drush. ## ## ## ... later on, to keep drush up to date, run the following: #cd /usr/local/src/drush-HEAD #cvs update -dPA
-
∞ htaccess redirect all traffic to homepage
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . http://domain.tld/index.php [L] </IfModule>
-
∞ install svn on shared host
#Install subversion on a shared host curl -O http://subversion.tigris.org/downloads/subversion-1.6.9.tar.gz curl -O http://subversion.tigris.org/downloads/subversion-deps-1.6.9.tar.gz curl -O http://www.openssl.org/source/openssl-0.9.8l.tar.gz tar zxvf openssl-0.9.8l.tar.gz tar zxvf subversion-1.6.9.tar.gz tar zxvf subversion-deps-1.6.9.tar.gz cd openssl-0.9.8l/ ./config shared --prefix=$HOME/installs && make clean && make && make install cd ../ export CFLAGS="-O2 -g -I$HOME/installs/include" export LDFLAGS="-L$HOME/installs/lib" export CPP="gcc -E -I$HOME/installs/include" cd subversion-1.6.9/neon/ ./configure --with-ssl=openssl --prefix=$HOME/installs cd ../ ./configure --with-ssl --prefix=$HOME/installs --with-neon=$HOME/installs/bin/neon-config make clean && make && make install echo 'store-plaintext-passwords=no' >> ~/.subversion/servers
-
∞ jython pervasive connection test
import java.lang as lib_lang import java.sql as lib_sql jdriver = "com.pervasive.jdbc.v2.Driver" # Java source driver url = "jdbc:pervasive://192.168.1.104:1583/PDB01" # jdbc url user_name = "dbadmin" # Source user name password = "password" # Source user password lib_lang.Class.forName(jdriver) # Register the driver jdbc = lib_sql.DriverManager.getConnection(url, user_name, password) stmt = jdbc.createStatement() # Create java statement dyn_task = "select * from TMP_TABLE" result_set = stmt.executeQuery(dyn_task) while result_set.next() > 0: print result_set.getString(1)
-
∞ jython oracle connection test
import java.lang as lib_lang import java.sql as lib_sql jdriver = "oracle.jdbc.driver.OracleDriver" # Java source driver url = "jdbc:oracle:thin:@192.168.1.101:1521:ORCL" # jdbc url user_name = "ODS" # Source user name password = "password" # Source user password lib_lang.Class.forName(jdriver) # Register the driver jdbc = lib_sql.DriverManager.getConnection(url, user_name, password) stmt = jdbc.createStatement() # Create java statement dyn_task = "select sysdate from dual" result_set = stmt.executeQuery(dyn_task) while result_set.next() > 0: print result_set.getString(1)
-
∞ start oracle db
#!/bin/sh if [ "$1" = "start" ]; then /u01/app/10g_r2/bin/dbstart echo "startup;" > $HOME/tmp.sql echo "exit;" >> $HOME/tmp.sql sqlplus sys/password as sysdba @$HOME/tmp.sql rm $HOME/tmp.sql else if [ "$1" = "stop" ]; then echo "shutdown;" > $HOME/tmp.sql echo "exit;" >> $HOME/tmp.sql sqlplus sys/password as sysdba @$HOME/tmp.sql rm $HOME/tmp.sql /u01/app/10g_r2/bin/dbshut fi fi
-
∞ remove .svn folders
find . -name ".svn" -type d -exec rm -rf {} \;
-
∞ detect linux distro
#!/bin/sh # Detects which OS and if it is Linux then it will detect # which Linux Distribution. OS=`uname -s` REV=`uname -r` MACH=`uname -m` GetVersionFromFile() { VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // ` } if [ "${OS}" = "SunOS" ] ; then OS=Solaris ARCH=`uname -p` OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" elif [ "${OS}" = "AIX" ] ; then OSSTR="${OS} `oslevel` (`oslevel -r`)" elif [ "${OS}" = "Linux" ] ; then KERNEL=`uname -r` if [ -f /etc/redhat-release ] ; then DIST='RedHat' PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` elif [ -f /etc/SUSE-release ] ; then DIST=`cat /etc/SUSE-release | tr "\n" ' '| sed s/VERSION.*//` REV=`cat /etc/SUSE-release | tr "\n" ' ' | sed s/.*=\ //` elif [ -f /etc/mandrake-release ] ; then DIST='Mandrake' PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` elif [ -f /etc/debian_version ] ; then DIST="Debian `cat /etc/debian_version`" REV="" fi if [ -f /etc/UnitedLinux-release ] ; then DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" fi OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" fi echo ${OSSTR}
-
∞ Set up mail forwarding on linux
# add a .forward file to your home directory touch .forward # add your email address vi .forward <user>@<mail>.com # change permission else it won't work chmod 600 .forward # test mail send, replace 'user' with your login mailx -s 'test from cluster' user < /dev/null
-
∞ apache configure htaccess defaults
# # AccessFileName: The name of the file to look for in each directory # for additional configuration directives. See also the AllowOverride # directive. # AccessFileName .htaccess # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ~ "^\.ht"> Order allow,deny Deny from all </Files>
-
∞ Bash Log Rotator
#!/bin/bash ## GLOBAL CONFIGURATIONS LOGS=( [0]="/usr/home/morpheus/cron/cron.log" ) DATE=$(date +"%y_%m_%d") for index in 0 do cp ${LOGS[index]} ${LOGS[index]}.${DATE} gzip -m9 ${LOGS[index]}.${DATE} cat /dev/null > ${LOGS[index]} printf "Log file rotated :)\n ============== \n" > ${LOGS[index]} done
-
∞ rsync over ssh
rsync -e ssh -av username@server.example.com:remote_directory local_directory
-
∞ java socket server
try { ServerSocket serverSocket = new ServerSocket(gameServerPort); logger.info("server started"); int clientCount = 0; while (true) { Socket socket = serverSocket.accept(); socket.setSoTimeout(IConstants.TIMEOUT); activeSockets.add(socket); if (activeSockets.size() >= maxClients) { socket.close(); logger.error("number of max clients reached."); } else { int clientID = clientCount++; logger.info("new client: " + clientCount); new Client(clientID, socket); } } } catch (BindException e) { logger.error("port " + gameServerPort + "already in use."); System.exit(1); } catch (IOException e) { logger.error("undefined error."); }
-
∞ top twenty processes by memory
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | head -21
-
∞ ssh port forwarding
#This forwards all localhost:1234 connections to google.com:80 through gimli ssh -L 1234:google.com:80 gimli.cs.berkeley.edu


