Skip to content

Instantly share code, notes, and snippets.

@Sen
Sen / certbot.service
Last active April 7, 2023 08:02
naive restart after Certbot cert updated
# /lib/systemd/system/certbot.service
[Unit]
Description=Certbot
Documentation=file:///usr/share/doc/python-certbot-doc/html/index.html
Documentation=https://letsencrypt.readthedocs.io/en/latest/
[Service]
Type=oneshot
ExecStart=/usr/bin/certbot -q renew --post-hook "kill -9 $(ps -aef | grep "caddy" | grep -v grep | awk '{ print $2 }')"
PrivateTmp=true
@Sen
Sen / sync_subtitle
Created November 7, 2022 09:30
fix subtitle
#!/usr/bin/env ruby
# sync subtitle with https://github.com/smacke/ffsubsync
video_ext = %w(mp4 mkv avi)
subtitle_ext = %w(srt ssa ass)
work_hash = []
files = Dir[Dir.pwd + '/*']
video_files = files.select do |file_name|
@Sen
Sen / mosdns.yml
Created August 16, 2022 14:34
dns setting on mosdns
log:
level: error
file: ''
plugin:
- tag: main_server
type: server
args:
entry:
- _no_ecs
@Sen
Sen / chromedriver_upgrader.rb
Last active March 1, 2021 03:45
chrome driver upgrade
chrome_string = %x(google-chrome --version)
chrome_string =~ /([\.\d]+)/
version = $1
local_chromedriver = %x(chromedriver --version) rescue ''
local_chromedriver =~ /([\.\d]+)/
local_chromedriver_version = $1
if version != local_chromedriver_version
url = "https://chromedriver.storage.googleapis.com/#{version}/chromedriver_linux64.zip"
class MyTestError < StandardError; end
class MyTest
attr_accessor :test
def initialize
@test = {}
end
def self.test(description, &block)
@Sen
Sen / main.rb
Last active August 29, 2015 14:17
def run
EventMachine::run {
Signal.trap("INT") { EventMachine.stop }
Signal.trap("TERM") { EventMachine.stop }
client = Faye::Client.new('http://tangpin.dev:6901/pulling')
store = Store.new
ws = WebSocket.new(client, store)
ws.subscribe
@Sen
Sen / mix.exs
Created May 4, 2014 12:47
cowboy
defmodule WebSocket.Mixfile do
use Mix.Project
def project do
[app: :bigdata_ws,
version: "0.0.1",
elixir: "~> 0.13.1",
deps: deps]
end
@Sen
Sen / entries.coffee
Created November 25, 2013 17:07
ember problem
Visahq.EntriesController = Ember.ArrayController.extend
needs: ['mattersNew']
content: Ember.computed.alias('controllers.mattersNew.entries')
itemController: 'entry'
@Sen
Sen / user.shadowsocks.plist
Created October 4, 2013 02:47
plist for shadowsocks-ruby version(rbenv)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>user.shadowsocks</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@Sen
Sen / user.shadowsocks.plist
Created May 20, 2013 05:52
my shadowsocks plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>user.shadowsocks</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>