Skip to content

Instantly share code, notes, and snippets.

@allex
allex / update-v2ray-geo.sh
Last active July 14, 2023 07:00 — forked from maddie/update-v2ray-geo.sh
Script for updating V2Ray geoip.dat and geosite.dat on OpenWRT
#!/bin/sh
# GistID: 12011d02da2e8b605a6cb715debb35f8
# GistURL: https://gist.github.com/allex/12011d02da2e8b605a6cb715debb35f8
LOGGER_TAG=v2ray-geodata-updater
log () {
echo "$@"
logger -t $LOGGER_TAG -- "$@"
@allex
allex / remotessh.go
Created July 4, 2023 06:02 — forked from tobgu/remotessh.go
Remote ssh exec using Go
package main
import (
"bufio"
"fmt"
"golang.org/x/crypto/ssh"
"io"
"log"
"os"
"strconv"
@allex
allex / GNU-Make.md
Created February 3, 2023 10:47 — forked from rueycheng/GNU-Make.md
GNU Make cheatsheet

NOTE -

  • Remove -h option if you are doing operation on same machine
  • Remove -u , -p option if your database don't have username and password

Binary

Import database

mongorestore -h IP:port -d DB_Name -u user_name -p password <input db directory>
@allex
allex / Dockerfile
Created January 12, 2022 14:47 — forked from shov/Dockerfile
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
@allex
allex / kubernetes-dashboard.md
Created August 2, 2021 15:08 — forked from tonysneed/kubernetes-dashboard.md
Kubernetes Dashboard
  1. Install the dashboard
    • Run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
  2. Create admin-user
    • Create a file named: dashboard-adminuser.yaml
    • Add this content:
apiVersion: v1
kind: ServiceAccount
metadata:
@allex
allex / self-signed-certificate-with-custom-ca.md
Created June 8, 2021 14:06 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@allex
allex / bash_strict_mode.md
Created June 2, 2021 02:16 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@allex
allex / foo.js
Created May 25, 2021 14:56 — forked from OliverJAsh/foo.js
function reverseFormatNumber(val,locale){
var parts = new Intl.NumberFormat(locale).formatToParts(1111.1);
var group = parts.find(part => part.type === 'group').value;
var decimal = parts.find(part => part.type === 'decimal').value;
var reversedVal = val.replace(new RegExp('\\' + group, 'g'), '');
reversedVal = reversedVal.replace(new RegExp('\\' + decimal, 'g'), '.');
return Number.isNaN(reversedVal)?0:+reversedVal;
}
console.log(reverseFormatNumber('1,234.56','en'));
@allex
allex / simple_args_parsing.sh
Created April 29, 2021 04:11 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"