Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
@iwinux
iwinux / Caddyfile
Created May 26, 2021 04:07
A fucking simple Caddyfile that disables some default shit
{
admin off
auto_https off
}
http://localhost:8080 {
file_server
}
@iwinux
iwinux / nginx.conf
Created May 27, 2019 10:45
Docker 服务发现机制的简单实现
upstream default {
server 127.0.0.1:12345;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local ok, err = balancer.set_current_peer(
ngx.ctx.upstream_host or '127.0.0.1',
ngx.ctx.upstream_port or 12345
)
@iwinux
iwinux / fix-mp3-tags.py
Last active February 28, 2019 02:42
brute-force ID3 encoding fix
from argparse import ArgumentParser
from os import path, walk
from typing import Iterable
import sys
from chardet import detect
from mutagen.id3 import Encoding, ID3, TextFrame
TARGET_FIELDS = {'TALB', 'TCOM', 'TIT2', 'TPE1', 'TPE2'}
@iwinux
iwinux / barely-tweaks.js
Last active May 28, 2018 02:23
UI / UX Tweaks for BearyChat
// ==UserScript==
// @name barely-tweaks
// @namespace http://tampermonkey.net/
// @version 0.6
// @description UI / UX Tweaks for BearyChat
// @author E.T
// @match https://*.bearychat.com/*
// ==/UserScript==
/* global document, fetch */
@iwinux
iwinux / pick-works.js
Last active March 19, 2016 13:39
选择困难症患者专用的 Chrome 脚本,在豆瓣阅读征文大赛作品列表里随机挑一本作品
// ==UserScript==
// @name pick-works
// @namespace http://tampermonkey.net/
// @version 0.1
// @author E.T
// @match https://read.douban.com/competition/2015/works*
// @grant none
// ==/UserScript==
;(function () {
@iwinux
iwinux / CSS line behind title text.markdown
Created March 2, 2016 14:08
CSS line behind title text
@iwinux
iwinux / a-warning.md
Created March 1, 2016 04:18 — forked from spion/a-warning.md
C++ versus V8 versus luajit versus C benchmark - (hash) tables

Warning

This benchmark has been misleading for a while. It was originally made to demonstrate how JIT compilers can do all sorts of crazy stuff to your code - especially LuaJIT - and was meant to be a starting point of discussion about what exactly LuaJIT does and how.

As a result, its not indicative of what its performance may be on more realistic data. Differences can be expected because

  1. the text will not consist of hard-coded constants
#!/bin/bash
#
# Calomel.org
# https://calomel.org/megacli_lsi_commands.html
# LSI MegaRaid CLI
# lsi.sh @ Version 0.05
#
# description: MegaCLI script to configure and monitor LSI raid cards.
# Full path to the MegaRaid CLI binary
@iwinux
iwinux / backend.conf
Last active October 13, 2015 04:12 — forked from caquino/backend.conf
invalidate Nginx cache via ngx-lua
server {
listen 80;
server_name backend;
root /usr/share/nginx/www;
index index.html index.html;
location / {
header_filter_by_lua '
@iwinux
iwinux / mjolnir.lua
Last active August 29, 2015 14:13
window centering
local window = require "mjolnir.window"
local hotkey = require "mjolnir.hotkey"
local desiredWidth = 1024
local desiredHeight = 768
hotkey.bind({"cmd", "shift"}, "m", function()
local win = window.focusedwindow()
local screenBounds = win:screen():frame()
local destX = (screenBounds.w - desiredWidth) / 2 + screenBounds.x