Skip to content

Instantly share code, notes, and snippets.

#用户 用户组
user www www;
#工作进程,根据硬件调整,有人说几核cpu,就配几个,我觉得可以多一点
worker_processes 5;
#错误日志
error_log logs/error.log;
#pid文件位置
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
@xfyuan
xfyuan / gist:dcf94a9572eef8dea130c52b96dc39da
Created July 26, 2019 01:18 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
rm -rf /Applications/Thunder.app/Contents/PlugIns/webgame.xlplugin #遊戲
rm -rf /Applications/Thunder.app/Contents/PlugIns/livestream.xlplugin #美女直播
rm -rf /Applications/Thunder.app/Contents/PlugIns/featuredpage.xlplugin #精選頁面
rm -rf /Applications/Thunder.app/Contents/PlugIns/xlbrowser.xlplugin #迅雷瀏覽器(會導致在迅雷內無法開啟網頁)
rm -rf /Applications/Thunder.app/Contents/PlugIns/xlplayer.xlplugin #迅雷播放器
rm -rf /Applications/Thunder.app/Contents/PlugIns/softmanager.xlplugin #應用卸載
rm -rf /Applications/Thunder.app/Contents/PlugIns/activitycenter.xlplugin #活動中心
rm -rf /Applications/Thunder.app/Contents/PlugIns/myvip.xlplugin #會員中心
rm -rf /Applications/Thunder.app/Contents/PlugIns/advertising.xlplugin #廣告
@xfyuan
xfyuan / Gemfile
Created June 28, 2020 01:57 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
#!/bin/bash
# rev4 - changes suggested by KownBash https://www.reddit.com/r/bash/comments/5cxfqw/i_wrote_a_simple_video_to_gif_bash_script_thought/da19gjz/
# Usage function, displays valid arguments
usage() { echo "Usage: $0 [-f <fps, defaults to 15>] [-w <width, defaults to 480] inputfile" 1>&2; exit 1; }
# Default variables
fps=15
width=480
@xfyuan
xfyuan / db.rake
Created July 27, 2020 01:46 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
#!/bin/bash
# Daniel Verner
# CarrotPlant LLC
# 2011
# Backup each mysql databases into a different file, rather than one big file
# Optionally files can be gzipped (dbname.gz)
#
# Usage: dump_all_databases [ -u username -o output_dir -z ]
#
# -u username to connect mysql server
@xfyuan
xfyuan / stimulus.md
Created July 28, 2020 02:40 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@xfyuan
xfyuan / logging.go
Created August 17, 2020 12:39 — forked from panta/logging.go
zerolog with file log rotation (lumberjack) and console output
package logging
import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"gopkg.in/natefinch/lumberjack.v2"
"os"
"path"
"io"
)
@xfyuan
xfyuan / bare_transitions.js
Created February 4, 2021 01:47 — forked from bnjamin/bare_transitions.js
Transitions stolen from alpine.js
export function transitionIn (el, show = () => {}) {
const attrs = getXAttrs(el, 'transition')
// If any transition attrs.
if (attrs.filter(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value)).length > 0) {
transitionClassesIn(el, attrs, show)
} else {
// If not, just show that damn thing.
show()
}