Skip to content

Instantly share code, notes, and snippets.

View liantian-cn's full-sized avatar
💬
I may be slow to respond.

liantian liantian-cn

💬
I may be slow to respond.
View GitHub Profile
@liantian-cn
liantian-cn / Dockerfile
Last active June 21, 2024 15:33
根据日出日落时间调节易来的色温和亮度
FROM alpine:latest
ENV TZ=Asia/Shanghai
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN echo "@testing https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update
RUN apk add bash python3 py3-pip py3-astral@testing py3-tz@testing py3-netifaces@testing
RUN ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
@liantian-cn
liantian-cn / debrick.sh
Created November 16, 2018 09:15
debrick.sh
#!/bin/bash
#
# The purpose of the script is to reinstall the operating system (debrick) on
# a harddrive that has been extracted from the housing of a WD MyBook Live.
#
#help screen
if [ $# = 1 -a "$1" = "--help" ]; then
echo "
standard use of script is:
@liantian-cn
liantian-cn / python.py
Created May 27, 2018 12:23
python wmimonitorid SerialNumberID
for obj in objWMI:
if obj.Active != None:
print("Active:" + str(obj.Active))
if obj.InstanceName != None:
print("InstanceName:" + str(obj.InstanceName))
if obj.ManufacturerName != None:
print("ManufacturerName:" + str(obj.ManufacturerName))
if obj.ProductCodeID != None:
print("ProductCodeID:" + str(obj.ProductCodeID))
if obj.SerialNumberID != None:
@liantian-cn
liantian-cn / Engine.ini
Created October 25, 2017 07:36
Engine.ini
[/Script/Engine.RendererSettings]
grass.DiscardDataOnLoad=1
r.DefaultFeature.Bloom=False
r.ReflectionEnvironment=0
r.DefaultFeature.AmbientOcclusion=False
r.DefaultFeature.AmbientOcclusionStaticFraction=False
r.DefaultFeature.AutoExposure=False
r.DefaultFeature.MotionBlur=0
r.DefaultFeature.LensFlare=0
r.AmbientOcclusionLevels=0
@liantian-cn
liantian-cn / gist:27c4836a2d96c902258d
Created August 23, 2015 11:31
CreateProcessWithLogonW Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
from ctypes.wintypes import *
INVALID_HANDLE_VALUE = -1
CREATE_UNICODE_ENVIRONMENT = 0x00000400
@liantian-cn
liantian-cn / gist:1ad08e774703a968c49f
Created February 27, 2015 12:27
shadowsocks-libev squid conf
http_port 127.0.0.1:3128 transparent
acl localhost src 127.0.0.1
acl thisvps src >>VPSIP<<
http_access allow localhost
http_access allow thisvps
http_access deny all
cache_mem 128 MB
@liantian-cn
liantian-cn / file
Last active October 26, 2022 18:51
shadowsocks iptables规则
# 新建一个无密码,无法登陆,没home的系统用户,就叫shadowsocks
adduser --system --disabled-password --disabled-login --no-create-home shadowsocks
# 修改 /etc/default/shadowsocks-libev
USER=shadowsocks
GROUP=nogroup
# 使用setcap,允许非root用户无法监听低位端口
apt-get install libcap2-bin
setcap 'cap_net_bind_service=+ep' /usr/bin/ss-server
root@do:~# iptables -nvL --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 270 39545 ACCEPT all -- lo * 127.0.0.0/8 127.0.0.0/8
2 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
3 8055 3839K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
4 3 132 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
5 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
6 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
7 161 7052 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:23
@liantian-cn
liantian-cn / gist:70ecbc40a896c9be2512
Last active December 2, 2023 18:21
List Task Schedule by Python
"""
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383607(v=vs.85).aspx
"""
import win32com.client
scheduler = win32com.client.Dispatch("Schedule.Service")
# list user task only
# scheduler.Connect()