Skip to content

Instantly share code, notes, and snippets.

View azizkhani's full-sized avatar
🏠
Working from home

Ali Akbar Azizkhani azizkhani

🏠
Working from home
View GitHub Profile
package com.example.molecues;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier;
import org.springframework.boot.CommandLineRunner;
@azizkhani
azizkhani / HttpServer.java
Created January 14, 2019 19:08
HttpServer
package com.syntaxcorrect.articles.smallhttpservers;
import com.sun.net.httpserver.HttpServer;
import java.io.OutputStream;
import java.net.InetSocketAddress;
public class TheComSunNetHttpServer{
static final int port=8080;
public static void main(String args[]){
@PsyGik
PsyGik / onesingal.service.ts
Created November 24, 2018 06:49
OneSignal Angular TypeScript
import {Injectable} from '@angular/core';
import {Cache} from '../utils/storage.provider'; // Decorator to access local storage
let OneSignal;
const url = '';
@Injectable()
export class OneSignalService {
@Cache({pool: 'OneSignal'}) oneSignalInit; // to check if OneSignal is already initialized.
@rahulkumar-aws
rahulkumar-aws / minikube.md
Last active March 22, 2024 14:57
Install/Uninstall Minikube from Mac
minikube stop; minikube delete
docker stop $(docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes
@azizkhani
azizkhani / docker
Last active September 15, 2018 17:21
//Stop all running containers
docker kill $(docker ps -aq)
//Remove all containers
docker rm $(docker ps -aq)
//Remove all images
docker rmi $(docker images -q)
@xshyamx
xshyamx / gav.sh
Created January 22, 2018 05:17
Shell script to generate a maven pom.xml from a list of jars
#!/bin/sh
lib_dir="$1"
if [ "$lib_dir" == "" ]; then
echo Please specifiy the directory for the jars
exit 1
fi
cat <<EOF | tee pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
@ariesmcrae
ariesmcrae / CreditCardMasker.java
Last active August 20, 2022 08:10
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()) {
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@paoloambrosio
paoloambrosio / .gitignore
Created April 26, 2012 16:24
Blog Post - Active Record pattern with Spring and AspectJ
# Maven
target
# Eclipse IDE
.project
.classpath
.settings