Skip to content

Instantly share code, notes, and snippets.

package main
/*
#cgo pkg-config: zlib
#cgo linux LDFLAGS: -lz
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
typedef struct {
@5lx
5lx / nginx-certbot.docker
Last active May 21, 2025 05:19
Alpine Nginx with auto renew letsencrypt certbot Dockerfile
FROM nginx:alpine
EXPOSE 80 443
VOLUME ["/etc/nginx/conf.d/", "/var/www/html", "/etc/letsencrypt"]
RUN apk add --no-cache certbot \
&& echo "0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew --post-hook \"nginx -s reload\"" > /etc/crontabs/root
CMD ["/bin/sh", "-c", "crond -b && certbot renew && nginx -g 'daemon off;'"]
# Resize. Suppose /dev/sda2 (LVM)
pvresize /dev/sda2
lvextend /dev/mapper/fedora-root -l+100%FREE
# For ext2/3/4
resize2fs /dev/mapper/fedora-root
# For xfs
xfs_growfs /
# Install Software
sudo dnf -y update
@5lx
5lx / README.md
Last active February 24, 2021 06:06
DNSSEC Spoofing Environment

Setup DNSSEC Spoofing Environment

You should switch to root user to execute following commands

System Requirement

Fedora, CentOS, or Red Hat.

Install Softwares

  • bind: Domain name server
  • bind-utils: some tools related with DNS
  • haveged: HArdware Volatile Entropy Gathering and Expansion, a simple entropy daemon to speed up keys generation (DNSSEC Keys Generation)
@5lx
5lx / README.md
Created February 14, 2018 23:21
Build Lib/App in home folder

For example, we will install libs/apps under ~/.local/

Prebuild configuring:

./configure --prefix=~/.local/

Add the following lines into .bashrc or .bash_profile:

# Add local bin path
@5lx
5lx / tensorflow.md
Last active November 8, 2018 23:45
Palmetto deep learning environment conf

Palmetto deep learning environment configuration

Get a compute node:

qsub -I -l select=1:ncpus=4:ngpus=1:gpu_model=k40:mem=16gb,walltime=10:00:00

For Python 2.7

Installation:

@5lx
5lx / udocf.sh
Created June 17, 2016 15:55
Update Digital Ocean Floating IP and Cloudflare DNS Record
#!/bin/bash
DO_TOKEN=
DO_API=https://api.digitalocean.com/v2
CF_API_KEY=
CF_AUTH_EMAIL=
CF_ROOT_DOMAIN=
CF_RECORD=
CF_API=https://api.cloudflare.com/client/v4