Skip to content

Instantly share code, notes, and snippets.

View Anzo52's full-sized avatar

Anzo52 Anzo52

View GitHub Profile
@Anzo52
Anzo52 / InstaInstall.ps1
Last active August 9, 2022 19:19
PowerShell script for installing Instaloader
# These two lines (3 and 4) will create the install location and change working directory. You can change the location or rename as needed.
# The location in both lines MUST match
mkdir C:\Users\Public\pip-instaloader
cd C:\Users\Public\pip-instaloader
# The next line will install the latest version of Python. Remove or comment out the line if you already have the latest version.
winget install Python
# Setting execution policy to allow Activation.ps1 script
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
@Anzo52
Anzo52 / fix.yml
Created May 16, 2022 02:00
Fix for "java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing"
cloud:
config:
fail-fast: false
@Anzo52
Anzo52 / SingeLineBuff.java
Created May 2, 2022 23:07
Using bufferedReader to read multiple integer values from single line of input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String lines = br.readLine();
String[] strs = lines.trim().split("\\s+");
for (int i = 0; i < strs.length; i++) {
a[i] = Integer.parseInt(strs[i]);
}

Windows to UNIX Command Cheat Sheet

Windows PowerShell has several transition aliases that allow UNIX and CMD users to use familiar command names in Windows PowerShell. The most common aliases are shown in the table below, along with the Windows PowerShell command behind the alias and the standard Windows PowerShell alias if one exists.

CMD Command UNIX Command PowerShell Command PowerShell Alias
dir ls Get-ChildItem gci
// Java method for fibonacci sequence using recursion
public static int fibonnaci(int num) {
num = (num < 2) ? num : (fibonnaci(num - 1) + fibonnaci(num - 2));
return num;
}
@Anzo52
Anzo52 / HelloWorld.scala
Created April 27, 2022 09:01
Hello World in Scala
object HelloWorld extends App {
println("Hello world!")
}
@Anzo52
Anzo52 / ConnectToPage.java
Created April 25, 2022 20:05
Java connecting to web page
URL url;
InputStream is = null;
DataInputStream dis;
String line;
try {
url = new URL("http://stackoverflow.com/");
is = url.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
@Anzo52
Anzo52 / ForWhile.java
Created April 25, 2022 18:44
How to translate between for loop and while loop
public class ForWhile {
int X = 10;
public static void forLoopExample() {
for (int i = 0; i <= X; i++) {
System.out.println(i);
}
}
@Anzo52
Anzo52 / web3jmaven.xml
Created April 19, 2022 23:08
Web3j Maven dependency
<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>3.3.1</version>
</dependency>