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
@azizkhani
azizkhani / CreditCardMasker.java
Created August 20, 2022 08:10 — 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()) {
@azizkhani
azizkhani / minikube.md
Created November 11, 2021 16:02 — forked from rahulkumar-aws/minikube.md
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 / merge-two-repository
Created November 19, 2020 12:38
merge-two-repository
git clone https://gitlab.com/open-projects-group/projects/enhancement/mono-repo
git remote add -f media-Information-service https://gitlab.com/open-projects-group/projects/enhancement/media-Information-service.git
git merge -s ours --allow-unrelated-histories --no-commit media-Information-service/master
git read-tree --prefix=media-Information-service/ -u media-Information-service/master
git commit -m "Merge media-Information-service project as our subdirectory"
git pull -s subtree media-Information-service master
Package "@toverux/ngx-sweetalert2" has an incompatible peer dependency to "@angular/core" (requires "^5.0.0 || ^6.0.0" (extended), would install "9.1.12").
Package "ng2-page-scroll" has an incompatible peer dependency to "@angular/platform-browser" (requires ">=4.2.6 <5.0.0" (extended), would install "9.1.12").
Package "@ng-bootstrap/ng-bootstrap" has an incompatible peer dependency to "@angular/forms" (requires "^7.0.0" (extended), would install "9.1.12").
Package "@toverux/ngx-sweetalert2" has an incompatible peer dependency to "@angular/common" (requires "^5.0.0 || ^6.0.0" (extended), would install "9.1.12").
Package "ng2-img-cropper" has an incompatible peer dependency to "@angular/compiler" (requires "^4.0.0" (extended), would install "9.1.12").
Package "ng2-page-scroll" has an incompatible peer dependency to "@angular/router" (requires ">=4.2.6 <5.0.0" (extended), would install "9.1.12").
processEngine().getRuntimeService().startProcessInstanceByKey("invoice-creation",
Variables.createVariables().putValueTyped("order",
Variables.objectValue(order).serializationDataFormat(SerializationDataFormats.JSON).create()));
@azizkhani
azizkhani / onesingal.service.ts
Created June 10, 2020 18:57 — forked from PsyGik/onesingal.service.ts
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.
@azizkhani
azizkhani / GenericService
Last active June 2, 2020 09:50
GenericRepositoryServicePattern
public interface IAbstarctRepository<T,PK extends Serializable> {
List<T> getAll();
T loadByEntityId(PK entityId);
boolean delete(T entity);
boolean deleteByEntityId(PK entityId);
void update(T entity);
PK saveOrUpdate(T entity);
boolean save(List<T> entities);
}
sudo apt-get remove golang-docker-credential-helpers
docker login
<login as normal>
sudo apt-get install docker-compose
sudo chmod 666 /var/run/docker.sock
/etc/netplan/50-cloud-init.yaml
networksetup -setdnsservers "iPhone USB" 8.8.8.8
dscacheutil -flushcache
@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[]){