Skip to content

Instantly share code, notes, and snippets.

@mandiwise
mandiwise / Count lines in Git repo
Last active October 11, 2025 19:44
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@shimarin
shimarin / normal-chroot.sh
Last active February 3, 2021 14:35
Explains unexpected /proc/[pid]/exe behavior with overlayfs+chroot environment
#!/bin/sh
CHROOT_DIR=`mktemp -d`
mkdir -p $CHROOT_DIR/bin $CHROOT_DIR/etc $CHROOT_DIR/proc
cp /bin/busybox $CHROOT_DIR/bin/ || exit
ln -s busybox $CHROOT_DIR/bin/ls
mount -t proc proc $CHROOT_DIR/proc
chroot $CHROOT_DIR /bin/ls -l /proc/self/exe
umount $CHROOT_DIR/proc
rm -rf $CHROOT_DIR
@regisdiogo
regisdiogo / Startup.cs
Last active July 26, 2025 11:17
ASP.NET Core - Json serializer settings Enum as string and ignore null values
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
});
}
@harshavardhana
harshavardhana / nginx-minio-static.md
Last active September 29, 2025 00:12 — forked from koolhead17/gist:4b8dd8d95ec86368634693cf9ad9391c
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@tinogomes
tinogomes / DNS_TO_LOCALHOST.markdown
Last active September 18, 2025 11:14
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com
@fire1ce
fire1ce / oh-my-zsh on openwrt or lede-project.md
Last active September 7, 2025 14:06
Install oh-my-zsh on openwrt/lede-project

Install oh-my-zsh on OpenWrt

Install Requirements Packages

opkg update && opkg install ca-certificates zsh curl git-http

Install oh-my-zsh

@Zonciu
Zonciu / usersecrets.ps1
Last active December 27, 2020 15:10
Manage User Secrets for .NET Core console application
<#
.NOTES
How to use: Open Visual Studio, go to Tools – External Tools to bring up the External Tools dialog, add a new tools menu with the following configuration:
Title: Manage User Secrets (Or whatever you want)
Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (Path to powershell.exe)
Arguments: Path-to-this-script(e.g. D:\VisualStudioTools\usersecrets.ps1)
Initial Directory: $(ProjectDir)
.PARAMETER ProjectFilePath
The csproj file's path, or keep it empty to search *.csproj file in initial directory
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active October 10, 2025 10:59
crack activate Office on mac with license file
@psxvoid
psxvoid / delete-evicted-pods-all-namespaces.sh
Created August 6, 2018 14:41
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces