Skip to content

Instantly share code, notes, and snippets.

View jimmyFlash's full-sized avatar
:atom:

Jamal jimmyFlash

:atom:
View GitHub Profile
@jimmyFlash
jimmyFlash / OpenSSL_cheatsheet.md
Created February 16, 2025 22:14
OpenSSL cheatsheet

Certificate types X.509 certificates: X.509 certificates are the most common type of digital certificate. They are often used for website security and for email encryption. X.509 certificates can be issued by either a trusted third party or by a company or organization include many types :-

  1. PEM (Privacy Enhanced Mail ): the most common type of X.509 certificate format and is most likely used in Unix/Linux-based operating systems. It is a Base64-encoded DER certificate. This is the format most of the Certificate Authorities (CA) issue certificates with .pem, .crt, .cer, or .key extensions. PEM certificates can be used with Apache, Microsoft IIS , and other web servers. It is possible to bundle the server certificate, the intermediate certificate, and the private key within a single PEM certificate. Or you can have all of them in a separate file.
  2. DER (Distinguished Encoding Rule) : is a binary form of a PEM certificate. Often *used in Windows and with Jav
@jimmyFlash
jimmyFlash / cmd_tricks.md
Created February 16, 2025 22:11
CMD glossary

Information gathering

Lookup windows error codes

Use CertUtil to Find Descriptions of Windows Error Codes. To start using CertUtil, launch a Command Prompt window on your PC. You can do this by opening the "Start" menu, searching for "Command Prompt", and selecting the tool. type the following command and press Enter. Enter the command below.

Example:

@jimmyFlash
jimmyFlash / cURL_windows.md
Last active February 16, 2025 22:08
cURL commands you can use on windows

What is the Curl command ?

  • Networking command available on windows, Linux and macOS.
  • Curl stands for (Client URL)

[!hint] cURL on windows Windows 10/11 come with curl built in them, you can use the curl command from PowerShell or cmd

@jimmyFlash
jimmyFlash / c_chape_vector.xml
Created July 18, 2020 08:43
A set of vector-drawables files for use in android projects
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportHeight="40.0"
android:viewportWidth="40.0">
<path
android:name="curves"
android:pathData="M 30 5
@jimmyFlash
jimmyFlash / proguard-rules.pro
Created July 10, 2020 10:20
Removing log calls using proguard / R8 rule
# no logging in production
-assumenosideeffects class android.util.Log {
v(...);
d(...);
i(...);
w(...);
e(...);
println(...);
}
@jimmyFlash
jimmyFlash / CurrencyAmoutBdecimalConverter.java
Last active May 24, 2020 11:43
Convert a currency formatted string to BigDecimal (double shouldn't be used to represent precision amounts)
import java.math.BigDecimal;
import java.util.Locale;
import java.text.*;
public class CurrencyAmoutBdecimalConverter{
public static void main(String []args)throws ParseException{
final String dollarsA = "$199.00";
final String real = "R$ 399,00";
final String dollarsB = "£25.00";
final String tailingEuro = "90,83 €";
@jimmyFlash
jimmyFlash / CurrencyFormatter.java
Created January 7, 2020 10:51
Formatting currency in java, standard and non-standard using country ISO code
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Locale;
import java.util.Scanner;
public class CurrencyFormatter {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
@jimmyFlash
jimmyFlash / Anagrams.java
Created January 7, 2020 10:45
solving anagrams, print anagrams and non-anagrams in sorted matter
import java.util.*;
import java.util.stream.Collectors;
public class Anagrams {
private static String[] anagrams = {
"pear",
"amleth",
"dormitory",
"tinsel",
"dirty room",
@jimmyFlash
jimmyFlash / ActivityDialogsExtensions.kt
Last active December 27, 2019 15:42
Set of extension function to use in your activity to display Alertdilog, Snackbar, toast or navigate to new activity
fun View.snack(message: String, length: Int = Snackbar.LENGTH_LONG, f: Snackbar.() -> Unit) {
val snack = Snackbar.make(this, message, length)
snack.f()
snack.show()
}
fun Snackbar.action(action: String, color: Int? = null, listener: (View) -> Unit) {
setAction(action, listener)
color?.let { setActionTextColor(color) }
}
@jimmyFlash
jimmyFlash / BundleExtension.kt
Last active December 27, 2019 11:49
Extension function that tries to put a value of arbitrary type to the bundle, and throws an exception if the type is not supported. thanks to (Dmitry Akishin)
fun <T> Bundle.put(key: String, value: T) {
when (value) {
is Boolean -> putBoolean(key, value)
is String -> putString(key, value)
is Int -> putInt(key, value)
is Short -> putShort(key, value)
is Long -> putLong(key, value)
is Byte -> putByte(key, value)
is ByteArray -> putByteArray(key, value)
is Char -> putChar(key, value)