This file contains 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
# example usage: | |
# listening 22 | |
# listening java | |
listening() { | |
if [ $# -eq 0 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | |
elif [ $# -eq 1 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1 | |
else | |
echo "Usage: listening [pattern]" |
This file contains 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.io.*; | |
import java.util.HashMap; | |
class FileRecursor { | |
private static HashMap<String, File> filesMap = new HashMap(); | |
private static long totalSize = 0; | |
public static void main(String[] args) { | |
System.out.println("==List all files in current directory and total size they occupy=="); | |
File folder = new File("."); |
This file contains 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 -f only works when run in the prompt before executing the script, may be due to my | |
# local setup | |
set -f | |
expr "${1}" "${2}" "${3}" | |
if [ $# -lt 3 ] | |
then | |
echo "Usage : $0 Operand Operation Operand" |
This file contains 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.example.reference; | |
import java.lang.ref.PhantomReference; | |
import java.lang.ref.ReferenceQueue; | |
import java.lang.ref.SoftReference; | |
import java.lang.ref.WeakReference; | |
/* | |
* https://dzone.com/articles/java-different-types-of-references | |
*/ | |
public class ReferenceExample { | |
private String status ="Hi I am active"; |