Skip to content

Instantly share code, notes, and snippets.

View zoonderkins's full-sized avatar
🏠
Working 👍

Quack~ zoonderkins

🏠
Working 👍
View GitHub Profile
@zoonderkins
zoonderkins / iptables-allow-cloudflare-access-only.md
Created December 18, 2021 04:17
[archive] Iptables allow Cloudflare IP access only

Script

    #!/bin/bash
    # Name  : Anti IP Leakage
    # Author: Zhys
    # Date  : 2019

    # 禁止来自IPv4的所有HTTP/S访问请求
@zoonderkins
zoonderkins / convert-png-to-jpg-via-cli.md
Last active December 16, 2021 08:45
convert png to jpg cli

Convert PNG to JPG via Imagick cli

mogrify -format jpg *.png

List too long issue

@zoonderkins
zoonderkins / linux-argument-list-too-long-solution.md
Created December 16, 2021 08:38
Linux: zsh: argument list too long solution

Error zsh: argument list too long solution

Scenerio: I've more than 50000 png file under current directory

ulimit -S -s unlimited

find ./ -name '*.png' -maxdepth 1 -exec mv {} final-qrcode \;

@zoonderkins
zoonderkins / nodejs-test-is-number.md
Last active December 12, 2021 07:52
nodejs-test-is-number

Test is number solution then do SQL

function isNumber(n) { return /^-?[\d.]+(?:e-?\d+)?$/.test(n); } 

app.get('/status', (req, res) => {
    let  { uid }  = req.query

    if (!isNumber(uid)) {
 res.send({"msg": "uid is not a number"})
@zoonderkins
zoonderkins / debian-sysctl-performance-tunning-and-security.md
Last active March 30, 2022 06:16
debian-sysctl-performance-tunning-and-security
### GENERAL SYSTEM SECURITY OPTIONS ###
###
# https://github.com/klaver/sysctl/blob/master/sysctl.conf
# https://github.com/sathrak/linux-sysctl.conf
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
@zoonderkins
zoonderkins / fix-apt-kept-back-issue.md
Last active December 10, 2021 03:44
fix apt's "the following packages have been kept back" issue
@zoonderkins
zoonderkins / debian-invalid-locales-fix.md
Created November 15, 2021 06:16
Debian invalid locales fix

Fix debian invalid locales

 The unknown environment variables are:
   LC_CTYPE=UTF-8 LC_ALL=
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:

 sudo dpkg-reconfigure locales
@zoonderkins
zoonderkins / prevent-data-recovery.md
Last active November 7, 2021 06:26
Preventing Data Recovery

Preventing Data Recovery [HDD/SSD]

Any Linux live cd would work. Then as others have said, the shred tool,

dd if=/dev/urandom of=/dev/disk”

This will fill it with totally random data.

@zoonderkins
zoonderkins / linux-control-systemd.md
Last active November 7, 2021 06:13
Linux control systemd

Linux control systemd

nano  /etc/systemd/journald.conf

# Set Max Use to 50M

[Journal]

SystemMaxUse=50M
@zoonderkins
zoonderkins / github-action-update-fork-repo.md
Created November 2, 2021 08:24
Github Action update fork repository

Github Action

name: Update Fork

on:
  schedule:
    - cron: "0 0 * * *"