Skip to content

Instantly share code, notes, and snippets.

View mali30's full-sized avatar
🏠

Mohamed Ali mali30

🏠
View GitHub Profile
@mali30
mali30 / typeofvar.sh
Created May 1, 2020 15:47 — forked from CMCDragonkai/typeofvar.sh
Bash: Get the type of a variable
#!/usr/bin/env bash
typeofvar () {
local type_signature=$(declare -p "$1" 2>/dev/null)
if [[ "$type_signature" =~ "declare --" ]]; then
printf "string"
elif [[ "$type_signature" =~ "declare -a" ]]; then
printf "array"
@mali30
mali30 / pom.xml
Created March 2, 2020 17:46 — forked from martensjostrand/pom.xml
Empty pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>artifactid</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>projectName</name>
@mali30
mali30 / jupyter_shortcuts.md
Created June 9, 2019 15:22 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@mali30
mali30 / .java
Created February 27, 2019 22:57
Method to validate if two strings are anagrams
public static boolean isAnagaram(String a, String b){
char [] to_char = a.toCharArray();
char [] to_char2 = b.toCharArray();
int l1 = a.length();
int l2 = b.length();
Arrays.sort(l1);
Arrays.sort(l2);