Skip to content

Instantly share code, notes, and snippets.

@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 / 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:
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
@d0zingcat
d0zingcat / markdown notes.md
Last active December 1, 2017 05:02
markdown notes
  1. Anchor at current page Github automatically parses anchor tags out of your headers. So you can do the following:
[Foo](#foo)
### Foo

In the above case, the Foo header has generated an anchor tag with the name foo

Note: just one # for all heading sizes, no space between # and anchor name, anchor tag names must be lowercase, and delimited by dashes if multi-word. Just like this:

@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 / 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
@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 / java notes.md
Last active December 1, 2017 05:03
java notes

单例模式

单例模式的主要作用是保证在Java程序中,某个类只有一个实例存在。一些管理器和控制器常被设计成单例模式。

单例模式有很多好处,它能够避免实例对象的重复创建,不仅可以减少每次创建对象的时间开销,还可以节约内存空间;能够避免由于操作多个实例导致的逻辑错误。如果一个对象有可能贯穿整个应用程序,而且起到了全局统一管理控制的作用,那么单例模式也许是一个值得考虑的选择。

Maven