IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » server The latest public server snipts.

showing 1-20 of 84 snipts for server
  • php get root dir
    $docRoot = getenv("DOCUMENT_ROOT");
    include $docRoot."/includes/config.php";
    

    copy | embed

    0 comments - tagged in  posted by aike on Aug 16, 2010 at 12:10 p.m. EDT
  • 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”
    }
    

    copy | embed

    0 comments - tagged in  posted by donie on Aug 02, 2010 at 2:17 a.m. EDT
  • 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
    

    copy | embed

    0 comments - tagged in  posted by Srykr on Jul 30, 2010 at 9:08 a.m. EDT
  • IP
    <?
    
    $ip = $_SERVER['REMOTE_ADDR'];
    
    echo "Su dirección IP es: $ip";
    
    ?>
    

    copy | embed

    0 comments - tagged in  posted by felgod on Jun 21, 2010 at 11:05 p.m. EDT
  • Linux: Dateien nach Inhalt suchen
    find -type f|xargs grep $keyword
    

    copy | embed

    0 comments - tagged in  posted by cbeier on Mar 07, 2010 at 2:23 p.m. EST
  • 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
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Mar 05, 2010 at 11:38 a.m. EST
  • 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>
    

    copy | embed

    0 comments - tagged in  posted by rendrag on Feb 06, 2010 at 1:49 p.m. EST
  • 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
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Jan 28, 2010 at 8:01 p.m. EST
  • 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)
    

    copy | embed

    0 comments - tagged in  posted by bgulcu on Jan 18, 2010 at 7:00 a.m. EST
  • 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)
    

    copy | embed

    0 comments - tagged in  posted by bgulcu on Jan 10, 2010 at 11:03 a.m. EST
  • 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
    

    copy | embed

    0 comments - tagged in  posted by bgulcu on Jan 10, 2010 at 10:54 a.m. EST
  • remove .svn folders
    find . -name ".svn" -type d -exec rm -rf {} \;
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Jan 06, 2010 at 11:47 a.m. EST
  • 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}
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Jan 06, 2010 at 11:20 a.m. EST
  • 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
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Dec 17, 2009 at 10:19 a.m. EST
  • 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>
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Dec 15, 2009 at 7:59 a.m. EST
  • 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
    

    copy | embed

    0 comments - tagged in  posted by john_clarke on Nov 29, 2009 at 12:32 a.m. EST
  • rsync over ssh
    rsync -e ssh -av username@server.example.com:remote_directory local_directory
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Nov 08, 2009 at 5:27 p.m. EST
  • 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.");
    }
    

    copy | embed

    0 comments - tagged in  posted by khakulov on Oct 17, 2009 at 12:07 p.m. EDT
  • top twenty processes by memory
    ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | head -21
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Oct 13, 2009 at 2:49 p.m. EDT
  • 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
    

    copy | embed

    0 comments - tagged in  posted by njoubert on Oct 07, 2009 at 3:29 p.m. EDT
Sign up to create your own snipts, or login.