Skip to content

Instantly share code, notes, and snippets.

@aslanshemilov
aslanshemilov / Main.java
Created March 7, 2025 13:12 — forked from Da9el00/Main.java
How to connect to An API using Java
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
public class Main {
@aslanshemilov
aslanshemilov / .editorconfig
Created January 12, 2025 06:24 — forked from m-jovanovic/.editorconfig
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
@aslanshemilov
aslanshemilov / README.md
Created January 15, 2024 05:52 — forked from piyushgarg-dev/README.md
Kafka Crash Course
@aslanshemilov
aslanshemilov / Dockerfile
Created January 15, 2024 05:52 — forked from piyushgarg-dev/Dockerfile
Docker In One Shot
FROM ubuntu
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get upgrade -y
RUN apt-get install -y nodejs
COPY package.json package.json
COPY package-lock.json package-lock.json
@aslanshemilov
aslanshemilov / java_download.sh
Created December 18, 2023 06:31 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@aslanshemilov
aslanshemilov / IE-disable-compatibility-view.bat
Created December 2, 2021 06:32 — forked from michal-m/IE-disable-compatibility-view.bat
Disable Compatibility View in Internet Explorer
@ECHO off
SETLOCAL
:: let's get the IE version first
SET qry=REG QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v Version
SET fnd=FINDSTR /I /L /C:"REG_SZ"
FOR /f "Tokens=2*" %%u IN ('%qry%^|%fnd%') DO ( SET IEVerReg=%%v )
FOR /f "Tokens=1,2,3,4 Delims=." %%a IN ("%IEVerReg%") DO ( SET IEVerMaj=%%a&SET IEVerMin=%%b&SET IEVerBld=%%c&SET IEVerRev=%%d )
IF %IEVerMaj% EQU 9 IF %IEVerMin% GEQ 10 SET IEVerMaj=10
@aslanshemilov
aslanshemilov / KafkaConsumer.java
Created September 23, 2021 06:04 — forked from stonegao/KafkaConsumer.java
Kafka consumer with Avro
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import kafka.message.MessageAndMetadata;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.Decoder;
import org.apache.avro.io.DecoderFactory;
@aslanshemilov
aslanshemilov / GetSystemPath.java
Created August 28, 2021 10:12 — forked from wayoda/GetSystemPath.java
Get the user.dir and codebase dir for a jar file invoked from the commandline
package org.wayoda.arduino;
import java.util.Properties;
import java.io.File;
public class GetSystemPath {
public GetSystemPath() {
Properties p=System.getProperties();
String userDir=p.getProperty("user.dir");
try {
@aslanshemilov
aslanshemilov / curl.md
Created August 12, 2021 06:17 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@aslanshemilov
aslanshemilov / CreditCardMasker.java
Created August 2, 2021 05:53 — forked from ariesmcrae/CreditCardMasker.java
Credit card masker. Any digits between 13 - 16 will be masked.
public static String maskCreditCard(String sentenceThatMightContainACreditCard) {
String maskedSentence = null;
// Find sequence of numbers between 13-16.
// Numbers can have dashes, spaces, or no dashes / no spaces.
Pattern regex = Pattern.compile("\\b(?:\\d[ -]*?){13,16}\\b");
Matcher regexMatcher = regex.matcher(sentenceThatMightContainACreditCard);
if (regexMatcher.find()) {