Skip to content

Instantly share code, notes, and snippets.

View djangofan's full-sized avatar

Jon Austen djangofan

View GitHub Profile
@djangofan
djangofan / Tracert.java
Last active December 17, 2023 15:31
Traceroute in Java
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Arrays;
import jpcap.JpcapCaptor;
import jpcap.JpcapSender;
@djangofan
djangofan / gist:2493145
Created April 25, 2012 20:36
Using etc alternatives to set default Java on CentOS
[user@www]# alternatives --install /usr/bin/java java /opt/jdk1.6.0_07/bin/java 2
[user@www]# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jdk1.6.0_07/bin/java
@djangofan
djangofan / gist:3113588
Created July 14, 2012 21:50
Cron job script to give a disk space usage alert email
#!/bin/sh
# this script was initially written for Redhat/CentOS
# file is /etc/cron.daily/diskAlert.cron
# requires enabling outgoing sendmail from localhost to a valid
# smtp server, which is usually disabled by default
ADMIN="jausten@adomain.com,another@adomain.com"
THRESHOLD=90
df -PkH | grep -vE '^Filesystem|tmpfs|cdrom|media' | awk '{ print $5 " " $6 }' | while read output;
do
@djangofan
djangofan / java_ocp_exam_1.8_study_notes.txt
Last active February 27, 2023 01:58
My notes while studying for the OCP exam
ACP notes: https://gist.github.com/djangofan/a8b3e82e585525467c454515a8fb9ecf
Practice Tests $9.99: http://enthuware.com/index.php/ocpjp-8-average-scores
Guided Practice $140: http://www.ucertify.com/exams/Oracle/1Z0-809.html
Transcender: https://www.transcender.com/premium-solution/oracle/1z0-809.kap
Remember: javac -Xprint package.classname
https://ocpjava.wordpress.com/presentations/
http://www.java2s.com/Tutorials/Java/java.util.stream/Collectors/ !! STUDY THIS!!!
https://github.com/eugenp/tutorials/tree/master/core-java
https://www.slideshare.net/ibrahimkurce/oca-java-se-8-exam-chapter-6-exceptions
https://docs.oracle.com/javase/8/docs/api/java/util/function/class-use/BiPredicate.html
@djangofan
djangofan / socat-config.sh
Last active January 25, 2023 09:03
socat daemon on OSX for Docker
#!/bin/bash
#brew install socat
# socat TCP-LISTEN:2377,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock
#file: docker.socat_listener
# <?xml version="1.0" encoding="UTF-8"?>
# <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
# <plist version="1.0">
# <dict>
@djangofan
djangofan / endorsedmethod.java
Last active January 6, 2023 22:05
Exercise on safely waiting for unstable web elements with WebDriver.
// This is the official Selenium documention endorsed method of waiting for elements.
// This method is ineffective because it still suffers from
// the stale element exception.
public static void clickByLocator ( final By locator ) {
WebElement myDynamicElement = ( new WebDriverWait(driver, 10))
.until( ExpectedConditions.presenceOfElementLocated( locator ) );
myDynamicElement.click();
}
@djangofan
djangofan / gist:2766613
Created May 22, 2012 04:38
Using RestAssured to do a SOAP web service request
package test.ra;
import static com.jayway.restassured.RestAssured.*;
import static com.jayway.restassured.path.xml.XmlPath.*;
import java.util.HashMap;
import java.util.Map;
public class SOAPDictionary {
@djangofan
djangofan / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Last active December 13, 2022 20:26 — forked from LayZeeDK/angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Angular CLI, Angular, Node.js, TypeScript, and RxJS version compatibility matrix. Mid-2021
Angular CLI version Angular version Node.js version TypeScript version RxJS version
1.0.0-beta.17 (package name: angular-cli) ~2.0.2 ^6.9.5 ~2.0.10 ^5.0.3
1.0.0-beta.20-1 (package name: angular-cli) ~2.1.2 ^6.9.5 ~2.0.10 ^5.0.3
1.0.0-beta.22-1 (package name: angular-cli) ~2.2.4 ^6.9.5 ~2.0.10 ^5.0.3
1.0.0-beta.30 ~2.3.1 ^6.9.5 ~2.0.10 ^5.0.3
1.0.0-rc.4 ~2.4.10 ^6.9.5 ~2.0.10 ^5.0.3
~1.0.6 >= 4.0.3 <= 4.1.3 ^6.9.5 ~2.2.2 ^5.0.3
~1.1.3 >= 4.0.3 <= 4.1.3 ^6.9.5 ~2.3.4 ^5.0.3
~1.2.7 >= 4.0.3 <= 4.1.3 ^6.9.5 ~2.3.4 ^5.0.3
~1.3.2 >= 4.2.6 <= 4.4.7 ^6.9.5 ~2.4.2 ^5.0.3
@djangofan
djangofan / gist:2865537
Created June 4, 2012 00:09
Dynamically load data into a DataProvider from a file using TestNG
@DataProvider(name = "DPMethodAlias") // Get A Form
public static Object[][] getFromFile() {
System.out.println("Loading data provider DPMethodAlias...");
// lastRun is a timestamp value used to find the .tests file
File tFile = new File( "test-output/work/" + WSUtils.getTestProperty("lastRun", "testng.config") + ".tests");
FileReader fileReader = null;
List<String> lines = new ArrayList<String>();
try {
String line = null;
fileReader = new FileReader( tFile );
These instructions require that you have Docker properly setup on your Windows computer:
docker volume create portainer_data
docker run -d -p 3040:9000 --name portainer --restart=always -v portainer_data:/data portainer/portainer --no-auth -H tcp://host.docker.internal:2375
docker volume create --name=bitcoind-data
docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d -p 18444:18444 -p 127.0.0.1:18332:18332 bitcoindevelopernetwork/bitcoind-regtest
then, open Portainer on localhost:3040
then, open the console to write commmands