Skip to content

Instantly share code, notes, and snippets.

@hughshen
hughshen / ADriveCheckIn.plugin
Last active April 1, 2025 13:28
Loon plugins and so on ...
#!name=阿里云盘签到
#!desc=阿里云盘签到。详情见仓库
#!openUrl=https://github.com/Sliverkiss/QuantumultX
#!author=Sliverkiss
#!homepage=https://github.com/Sliverkiss/QuantumultX
#!icon=https://raw.githubusercontent.com/Softlyx/Fileball/main/YUAN/ALiYun.png
[Script]
cron "0 7,11 * * *" script-path=https://gist.githubusercontent.com/Sliverkiss/33800a98dcd029ba09f8b6fc6f0f5162/raw/aliyun.js, tag=阿里云盘签到
FROM alpine:3.9
# trust this project public key to trust the packages.
ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
RUN apk --update add ca-certificates \
&& echo "https://dl.bintray.com/php-alpine/v3.9/php-7.3" >> /etc/apk/repositories \
&& apk --update add \
tzdata \
php \
FROM php:7.3-apache
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y \
curl \
git \
zip \
unzip \
@hughshen
hughshen / Dockerfile-ssh
Created September 15, 2020 15:15
Dockerize an SSH service
FROM ubuntu:18.04
ARG USER=docker
ARG PASS=docker
ARG UID=1000
ARG GID=1000
RUN sed -i 's/\(archive\|security\).ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
&& mkdir /var/run/sshd \
&& apt-get update \
input:focus::-webkit-input-placeholder,
input:focus:-moz-placeholder, /* FF 4-18 */
input:focus::-moz-placeholder, /* FF 19+ */
input:focus:-ms-input-placeholder, /* IE 10+ */
textarea:focus::-webkit-input-placeholder,
textarea:focus:-moz-placeholder,
textarea:focus::-moz-placeholder,
textarea:focus:-ms-input-placeholder {
color: transparent;
}
@hughshen
hughshen / validateDate.php
Created August 11, 2017 16:09
With DateTime you can make the shortest date&time validator for all formats. http://php.net/manual/en/function.checkdate.php#113205
<?php
function validateDate($date, $format = 'Y-m-d H:i:s')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
var_dump(validateDate('2012-02-28 12:12:12')); # true
var_dump(validateDate('2012-02-30 12:12:12')); # false
@hughshen
hughshen / css-ellipsis.css
Created June 26, 2017 13:44
CSS 超出内容以省略号代替。
.ellipsis {
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@hughshen
hughshen / mail.php
Last active September 13, 2019 09:06
OpenCart 使用 PHPMailer 替换默认的邮件类
<?php
class Mail {
protected $to;
protected $from;
protected $sender;
protected $subject;
protected $text;
protected $html;
protected $attachments = array();
public $protocol = 'mail';
@hughshen
hughshen / OpenedFilesCount.py
Created February 5, 2017 12:09
Simple plugin for Sublime Text to display the opened files count in the status bar.
import sublime
import sublime_plugin
class OpenedFilesCountPlugin(sublime_plugin.EventListener):
def __init__(self):
return
def on_activated(self, view):
@hughshen
hughshen / regex.php
Last active October 25, 2016 13:44
Simple regex tester. Textarea highlight inspire by http://codersblock.com/blog/highlight-text-inside-a-textarea
<?php
if (count($_POST) > 0) {
$res = '';
$text = isset($_POST['text']) ? $_POST['text'] : '';
$pattern = isset($_POST['pattern']) ? $_POST['pattern'] : '';
$eachLine = isset($_POST['each_line']) ? (int)$_POST['each_line'] : 0;
if ($pattern) {
if ($eachLine == 1) {
$text = nl2br($text);
$textArr = explode('<br />', $text);