Skip to content

Instantly share code, notes, and snippets.

@d0zingcat
d0zingcat / init.sh
Created February 7, 2022 07:38
bootstrap for openwrt on r2s
#!/bin/sh
set -x
install_openclash() {
opkg remove dnsmasq
opkg install dnsmasq-full
opkg install luci
opkg install luci-base
opkg install iptables opkg install coreutils
opkg install coreutils-nohup
opkg install bash
@d0zingcat
d0zingcat / cloudflare_dyn_dns.sh
Last active June 5, 2021 04:44 — forked from chappy84/cloudflare_dyn_dns.sh
CloudFlare Dynamic DNS Shell Script
##!/usr/bin/env sh
# Gist: https://gist.github.com/D0zingcat/8cd76dc49d28c99af010c67a4a94d30b
# forked from: https://gist.github.com/chappy84/9606755
# use environment variables instead of flags (as in docker pass parameters is not very convenient)
# a docker image is derived from this script: d0zingcat/ddns-reporter (:latest tag for amd x86-64 arch and :armv8 tag for arm x64 v8 arch, e.g. raspberry pi 4B
# you could use this image to report your dynamic public ip to cloudflare(to update your A DNS record)
# command: docker run -e KEY=${KEY} -e NAME=${subdomain} -e EMAIL=${cloudflare_email} -e ZONE={base_domain} d0zingcat/ddns-reporter:latest
# Dockerfile: https://github.com/D0zingcat/all-in-docker/blob/main/ddns-reporter/Dockerfile
# CloudFlare Dynamic DNS
#
@d0zingcat
d0zingcat / rclone-download.sh
Last active December 18, 2020 10:40
download rclone and replace binary program with latest rclone
#!/usr/bin/env bash
set -x
rclone_zip=rclone.zip
curl -L https://downloads.rclone.org/rclone-current-linux-amd64.zip -o $rclone_zip
unzip -o $rclone_zip
dir_name=`ls -F | grep -e 'rclone.*/'`
version=`echo $dir_name | cut -d"-" -f2`
echo $dir_name, $version
name_with_version="rclone_$version"
cp "$dir_name"/rclone /usr/local/bin/$name_with_version
@d0zingcat
d0zingcat / installChaCha20.sh
Created May 9, 2016 05:02
Install ChaCha20 Encryption for Shadowsocks On CentOS
yum install m2crypto gcc -y
wget -N --no-check-certificate https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar zfvx libsodium-*.tar.gz
cd libsodium-*
./configure
make && make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
@d0zingcat
d0zingcat / linux calendar
Created January 31, 2018 13:58
A simple unix calendar implementation in python
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import os
def print_months(year, month):
if year < 1900:
@d0zingcat
d0zingcat / swiss-army knives.md
Last active December 26, 2017 14:13
swiss-army knives

Text processing

Name Usage
Pandoc Convert one markup format to another

Community

Name Usage
Launchpad A software collaboration platform that engages developer developing softwares on Ubuntu
@d0zingcat
d0zingcat / git notes.md
Last active December 20, 2017 16:24
git notes
commands scope common user cases
git reset Commit Discard commits in a private branch or throw away uncommited changes
git reset File Unstage a file
git checkot Commit switch between branches or inspect old snapshot
git checkout File Discard changes in the working directory
git revert commit Undo commits in a public branch
git revert File 不支持
git push -u origin master persistence on next push, "origin master" can be ommitted.
@d0zingcat
d0zingcat / mess notes.md
Last active December 20, 2017 16:21
mess notes

Docker notes

  1. docker Network differenece between EXPOSE and PUBLISH: Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports. Exposing ports is optional.

Best practives in [?]nix

command line proxy: proxychains

@d0zingcat
d0zingcat / linux notes.md
Last active December 18, 2017 08:22
linux notes

Without other narrates, this note is only intended for Debian or Ubuntu.

command function usage
update-alternatives multi-version runnable program preference management
test -x ${file} test if ${file} exists and granted with executable permission
if [ -f ${file} ] test if this file is a regular file
set -e cause the shell to exit if any subcommand or pipeline returns a non-zero status
https://ide.c9.io/d0zingcat/dailylabs | dailylabs - Cloud9
https://miki725.github.io/docker/crypto/2017/01/29/docker+nginx+letsencrypt.html | Docker + Nginx + LetsEncrypt — » Miroslav Shubernetskiy
https://github.com/jwilder/nginx-proxy | jwilder/nginx-proxy: Automated nginx proxy for Docker containers using docker-gen
https://github.com/clarkzjw/nginx-proxy-google | clarkzjw/nginx-proxy-google: Docker image of Nginx reverse proxy for Google
https://stackoverflow.com/questions/24241292/dockerized-nginx-is-not-starting | docker - Dockerized nginx is not starting - Stack Overflow
https://bitbucket.org/account/signin/
https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html | Set up an SSH key - Atlassian Documentation
https://hub.docker.com/ | Docker Hub
https://www.linux.com/news/5-linux-desktop-environments-rise-2017 | 5 Linux Desktop Environments on the Rise for 2017 | Linux.com | The source for Linux information
https://www.ubuntupit.com/install-various-desktop-environment-ubuntu/ | 13 B