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 testapps.networking; | |
| import java.io.IOException; | |
| import java.net.DatagramPacket; | |
| import java.net.DatagramSocket; | |
| import java.net.InetAddress; | |
| import java.net.MulticastSocket; | |
| import java.net.SocketException; | |
| import java.net.UnknownHostException; | |
| import java.util.Scanner; |
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 testapps.sound.midi; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Random; | |
| import javax.sound.midi.MidiChannel; | |
| import javax.sound.midi.MidiSystem; | |
| import javax.sound.midi.MidiUnavailableException; | |
| import javax.sound.midi.Synthesizer; |
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 | |
| REQUIREMENTS=( git curl vim ) | |
| REPO=https://bitbucket.org/kisp/dotfiles.git | |
| VIMFILES_REPO=https://github.com/ypetya/vimfiles.git | |
| function require() { | |
| echo "require $1" | |
| if ! type -t $1 2>&1 >> /dev/null ; then | |
| echo "$1 not installed yet!" |
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 tools; | |
| import java.io.IOException; | |
| import java.nio.file.FileSystem; | |
| import java.nio.file.FileSystems; | |
| import java.nio.file.FileVisitResult; | |
| import java.nio.file.Files; | |
| import static java.nio.file.LinkOption.NOFOLLOW_LINKS; | |
| import java.nio.file.Path; | |
| import java.nio.file.SimpleFileVisitor; |
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
| public static String loadJMXAgent(int port) throws IOException, | |
| AttachNotSupportedException, AgentLoadException, | |
| AgentInitializationException { | |
| String name = ManagementFactory.getRuntimeMXBean().getName(); | |
| VirtualMachine vm = VirtualMachine.attach(name.substring(0, | |
| name.indexOf('@'))); | |
| String lca = vm.getAgentProperties().getProperty( | |
| "com.sun.management.jmxremote.localConnectorAddress"); | |
| if (lca == null) { |
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 | |
| #set -x | |
| # Shows you the largest objects in your repo's pack file. | |
| # Written for osx. | |
| # | |
| # @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ | |
| # @author Antony Stubbs | |
| # set the internal field spereator to line break, so that we can iterate easily over the verify-pack output |
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
| # this function helps you to find a jar file for the class | |
| function find_jar_of_class() { | |
| OLD_IFS=$IFS | |
| IFS=$'\n' | |
| jars=( $( find -type f -name "*.jar" ) ) | |
| for i in ${jars[*]} ; do | |
| if [ ! -z "$(jar -tvf "$i" | grep -Hsi $1)" ] ; then | |
| echo "$i" | |
| fi |
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
| function ln() { | |
| echo "WARNING! 'ln' is an unsupported command on this platform." | |
| echo " * The following command was called:" | |
| echo "ln $@" | |
| if [ $1 = "-s" ] ; then | |
| echo " * Trying to translate it to a simple copy command : " | |
| COMMAND="cp -R $2 $3" | |
| echo "$COMMAND" |
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
| # ssh completion | |
| if [ -f ~/.ssh/config ] ; then | |
| SSH_COMPLETE=( $(grep "^Host " ~/.ssh/config | cut -f2 -d ' ' | sort -u ) ) | |
| SSH_COMPLETE=( ${SSH_COMPLETE[*]} $(grep "\w*User " ~/.ssh/config | cut -f2 -d ' ' | sort -u ) ) | |
| fi | |
| if [ -f ~/.ssh/known_hosts ] ; then | |
| SSH_COMPLETE=( ${SSH_COMPLETE[*]} $(cut -f1 -d' ' ~/.ssh/known_hosts | cut -f1 -d',' | sort -u )) | |
| fi | |
| complete -o default -W "${SSH_COMPLETE[*]}" ssh | |
| complete -o default -W "${SSH_COMPLETE[*]}" scp |
