Skip to content

Instantly share code, notes, and snippets.

@nansenat16
nansenat16 / Dockerfile
Created September 29, 2019 13:46
php7.2.23-phpunit8-xdebug2.7.2-pgsql11.5
FROM php:7.2.23
ENV XDEBUG_CONFIG="remote_host=127.0.0.1"
RUN curl -L -o /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-8.phar \
&& chmod 755 /usr/local/bin/phpunit \
&& ln -s /usr/local/bin/phpunit /bin/phpunit \
&& cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini \
&& pecl config-set php_ini /usr/local/etc/php/php.ini \
&& pear config-set php_ini /usr/local/etc/php/php.ini \
@nansenat16
nansenat16 / godaddy-ddns.txt
Last active November 7, 2023 13:08
RouterOS godaddy-ddns-update-script
#GoDaddy DDNS Update Script
#Test with RouterOS 6.45.2 (Minimum version RouterOS 6.44)
#Date:2019/08/02
#The read,write,policy,test that all of these policies need to be set in script for the global variable
#ref1 https://www.instructables.com/id/Quick-and-Dirty-Dynamic-DNS-Using-GoDaddy/
#ref2 http://www.minitw.com/post/2018/05/09/routeros-ddns-namecheap
#Easy Test
# /tool fetch url="https://api.godaddy.com/v1/domains/[domain]/records/A/[hostname]" http-method=put http-data="[{\"data\": \"10.10.10.10\"}]" http-header-field="content-type: application/json,Authorization: sso-key [API_KEY]:[API_SECRET]"
@nansenat16
nansenat16 / spamassassin-custom.cf
Created December 10, 2018 11:24
PMG custom rule
header SUBJECT_ORDER_KEYWORD Subject =~ /訂單|訂購|訂貨/
score SUBJECT_ORDER_KEYWORD -2.5
describe SUBJECT_ORDER_KEYWORD Subject Order/PO Keyword
header SUBJECT_PAY_KEYWORD Subject =~ /發票|銷貨|轉帳/
score SUBJECT_PAY_KEYWORD -2.5
describe SUBJECT_PAY_KEYWORD Subject Payment Keyword
@nansenat16
nansenat16 / spamreport-custom.tt
Created December 8, 2018 15:14
Proxmox Mail Gateway SPAM report custom template [zh-tw]
[%- IF timespan == 'week' -%]
[%- SET title = "Weekly Spam Report- ${date}'" -%]
[%- ELSE %]
[%- SET title = "=?UTF-8?Q?=E5=9E=83=E5=9C=BE=E9=83=B5=E4=BB=B6=E9=9A=94=E9=9B=A2=E6=B8=85=E5=96=AE?= ${date}" -%]
[%- END -%]
[% BLOCK tooltip %]接收時間: [% d.date %] [% d.time %]
寄件者: [% d.envelope_sender %]
收件者: [% d.receiver %]
大小: [% d.bytes %]
stdin=["44+44=88","4+6=10","6-2=4","2-6=?","6-3=2"]
total=0
for line in stdin:
data=list(line)
if('?' in data):
total+=0
elif('+' in data):
a=''.join(data[0:data.index('+')])
b=''.join(data[data.index('+')+1:data.index('=')])
d=int(a)+int(b)
@nansenat16
nansenat16 / release-msg-noauth.cgi
Created March 13, 2016 09:01
EFA Release SPAM non-Auth Version
#!/usr/bin/perl
# +--------------------------------------------------------------------+
# EFA release spam message script version 20140105
# This script is an modification of the previous ESVA release-msg.cgi
# +--------------------------------------------------------------------+
# Copyright (C) 2013~2015 http://www.efa-project.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@nansenat16
nansenat16 / quarantine_report_zh_TW.php
Created March 13, 2016 08:51
MailWatch Quarantine Report zh_TW
#!/usr/bin/php -q
<?php
/*
MailWatch for MailScanner
Copyright (C) 2003-2011 Steve Freegard (steve@freegard.name)
Copyright (C) 2011 Garrod Alwood (garrod.alwood@lorodoes.com)
Copyright (C) 2014-2015 MailWatch Team (https://github.com/orgs/mailwatch/teams/team-stable)
This program is free software; you can redistribute it and/or modify
@nansenat16
nansenat16 / export_account.php
Created July 19, 2015 08:22
Import Linux account,passwd transform to LDIF format.
<?php
///////////////////////////////////////////////////////////
//
// Import Linux account,passwd transform to LDIF format.
// Ex: move account from openwebmail to Zimbra Mail System
//
// 2015/06/21 by nansenat16
//
///////////////////////////////////////////////////////////
@nansenat16
nansenat16 / dns_rec.php
Last active December 29, 2015 10:59
tcpdump sniffer DNS query and log it
<?php
// Usage:
// #tcpdump -i eth1 -n|grep domain|php dns_rec.php
// #nohup tcpdump -i eth1 -n|grep domain|php dns_rec.php &
//
ini_set('memory_limit','256M');
$qmap=array();
define('LOG_PATH','/root/dns_%s.csv');
$f=fopen('php://stdin','r');
@nansenat16
nansenat16 / stop_countback.html
Created July 19, 2013 04:06
示範更換分頁停止倒數
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
var count=0;
$(window).blur(function(){
console.log('out');
$('#msg').data('where','out');
});