Skip to content

Instantly share code, notes, and snippets.

@forthxu
forthxu / date_convert_osx_example.sh
Created September 7, 2022 02:22 — forked from benwei/date_convert_osx_example.sh
MacOS convert timestamp by date command with GNU bash
#!/bin/bash
# author: terry, ben
# tested GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
# FYR (for Mac OS, may need some change for linux)
# second -> ISO8601
date -u -r 1453951368 +%FT%TZ
## ouptput: 2016-01-28T03:22:48Z
# ISO8601 -> second
date -ju -f "%FT%TZ" 2016-01-28T03:22:48Z +%s
## output: 1453951368
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@forthxu
forthxu / qq_message_xml.md
Created November 20, 2016 11:08 — forked from koukuko/qq_message_xml.md
发送XML消息的格式

QQ的XML消息格式整理

QQ可以使用xml的方式发送消息,以下为了方便描述统称为卡片。

发送方式

通过机器人的API进行发送xml即可,但是如果选择发送xml,那么其他如[image=xxx][@xxx]这些命令就不可使用了。整个消息只有XML。

基本结构

xml主要由msg,item,source这3部分组成

<?xml version='1.0' encoding='utf-8' standalone='yes'?>
@forthxu
forthxu / post-receive.sh
Last active September 14, 2015 03:52 — forked from icyleaf/post-receive.sh
git autodeploy script when it matches the string "[deploy]"
#!/bin/sh
#
# git autodeploy script when it matches the string "[deploy]"
#
# @author icyleaf <icyleaf.cn@gmail.com>
# @link http://icyleaf.com
# @version 0.1
#
# Usage:
# 1. put this into the post-receive hook file itself below
@forthxu
forthxu / README.md
Last active August 29, 2015 14:17 — forked from chuangbo/README.md

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&amp;login_password=xxx&amp;domain_id=xxx"

@forthxu
forthxu / redis-server
Last active August 29, 2015 14:14 — forked from tessro/redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid