Skip to content

Instantly share code, notes, and snippets.

View thuanpham582002's full-sized avatar
🍀
cosmic signal

thuanpham582002

🍀
cosmic signal
View GitHub Profile
#!/bin/bash
# This script merges multiple kubeconfig files into one while preserving existing configurations
set -e
# Step 1: Create backup directory if it doesn't exist
BACKUP_DIR="$HOME/.kube/backups"
mkdir -p "$BACKUP_DIR"
# Step 2: Create timestamped backup of current config
package com.streetvoice.streetvoice.player;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import java.util.Arrays;
import java.util.LinkedList;
@lucakiebel
lucakiebel / mongodump_in_docker-compose.sh
Last active May 15, 2024 18:28
Use Mongodump and Mongorestore to backup and restore MongoDB Databases run in docker-compose
docker-compose exec -T mongodb mongodump --authenticationDatabase admin -u root -p password --db test --archive --gzip > dump.gz
@fiftyonemoon
fiftyonemoon / AndroidXI
Created July 12, 2021 14:57
File create, rename, duplicate and delete in Android11.
import android.app.PendingIntent;
import android.app.RecoverableSecurityException;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.IntentSender;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
@hermanbanken
hermanbanken / Dockerfile
Last active March 1, 2025 03:18
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active March 3, 2025 02:08
crack activate Office on mac with license file
@posener
posener / go-shebang-story.md
Last active January 24, 2025 22:26
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@mcastelino
mcastelino / iptables-cheatsheet.md
Last active February 13, 2025 18:43
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@adamrunner
adamrunner / gen_cert.sh
Created March 31, 2016 18:26
bash script to generate a self signed certificate for development use
#!/bin/bash
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
#
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html
#
# Additional alterations by: Brad Landers
# Date: 2012-01-27