This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import org.hyperic.sigar.CpuInfo; | |
import org.hyperic.sigar.CpuPerc; | |
import org.hyperic.sigar.Sigar; | |
import org.hyperic.sigar.SigarException; | |
import org.hyperic.sigar.cmd.Ps; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Tomcat Server" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
# run as non privileged user | |
# add user with this command: | |
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ayosec.misc; | |
import com.sun.jna.*; | |
public class LibC { | |
public interface Handle extends Library { | |
Handle module = (Handle) Native.loadLibrary("c", Handle.class); | |
int getpid(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetSocketAddress; | |
import java.net.SocketAddress; | |
import java.nio.charset.Charset; | |
import java.util.Random; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import org.jboss.netty.bootstrap.ClientBootstrap; | |
import org.jboss.netty.bootstrap.ServerBootstrap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; | |
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.OK; | |
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; | |
import java.net.InetSocketAddress; | |
import java.nio.charset.Charset; | |
import java.util.concurrent.Executors; | |
import junit.framework.Assert; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Requires JNA | |
* Get jna.jar here: http://java.net/projects/jna/sources/svn/show/trunk/jnalib/dist | |
*/ | |
import com.sun.jna.Library; | |
import com.sun.jna.Native; | |
public class SelfKiller | |
{ | |
private interface CLibrary extends Library | |
{ |
NewerOlder