Skip to content

Instantly share code, notes, and snippets.

@kols
kols / waitForKeyElements.js
Created January 13, 2023 10:32
waitForKeyElements.js
/**
* A utility function for userscripts that detects and handles AJAXed content.
*
* @example
* waitForKeyElements("div.comments", (element) => {
* element.innerHTML = "This text inserted by waitForKeyElements().";
* });
*
* waitForKeyElements(() => {
* const iframe = document.querySelector('iframe');
@kols
kols / dim_wishlist.txt
Last active April 20, 2022 09:53
DIM wishlist
title: my wishlist
description: my wishlist
// silicon nuroma (adept)
dimwishlist:item=1387987271&perks=839105230,2420895100,3400784728,2896038713
dimwishlist:item=1387987271&perks=3250034553,1561002382,957782887,47981717
@kols
kols / fallout-1-high-res-patch-mac-osx.md
Last active April 19, 2024 21:39 — forked from robatron/fallout-1-high-res-patch-mac-osx.md
How to get the Fallout 1 (and Fallout 2) high-resolution patch working for Mac OS X

Fallout 1 (and Fallout 2) Hi-Res Patch for Mac OS X

Fallout 1 was originally designed to run at 640x480 resolution. I wanted to run the Mac OS X version of Fallout on my MacBook 11", which has a 1366x768 display. There is a [high resolution patch][hi-res], but it only supports the Windows version of Fallout.

Turns out that the OS X version of Fallout runs through Wine, so we can get this patch working with just a few configuration changes:

Note for Fallout 2 users: The process for Fallout 2 is essentially the same, with a different patch, and some minor pathing differences. Other than that, the process is exactly the same!

Install Wine

@kols
kols / chnroutes.yml
Created August 4, 2015 15:45
ansible chnroutes ipset with bestroutetb
---
- name: generate chnroutes
shell: >
bestroutetb -p custom --rule-format=$'%prefix/%length\n' --group-header=$'---%name-start\n' --group-footer=$'---%name-end\n' --group-gateway -s -f -o /tmp/chnroutes.txt
&& sed -i '' -e '/---vpn-start/,/---vpn-end/d' -e '/^---/d' /tmp/chnroutes.txt
delegate_to: localhost
- name: upload chnroutes.txt
copy: src=/tmp/chnroutes.txt dest=/opt/scripts/chnroutes.txt
register: uploaded
go test ./pkg/... ./cmd/... -race
? github.com/wandoulabs/codis/pkg/env [no test files]
2015/05/28 18:15:51 action_test.go:36: [info] test proxy offline when waiting action response 
2015/05/28 18:15:54 action.go:132: [error] proxies didn't responed: [3 1 2] 
2015/05/28 18:15:54 action.go:137: [error] mark proxy 3 to PROXY_STATE_MARK_OFFLINE
2015/05/28 18:15:54 proxy.go:192: [info] mark_offline, check proxy status: 3 &{3 0 offline 0 } <nil> 
2015/05/28 18:15:54 proxy.go:200: [info] proxy: 3 offline success! 
2015/05/28 18:15:54 action.go:137: [error] mark proxy 1 to PROXY_STATE_MARK_OFFLINE
2015/05/28 18:15:54 proxy.go:192: [info] mark_offline, check proxy status: 1 &{1 0 offline 0 } <nil> 
2015/05/28 18:15:54 proxy.go:200: [info] proxy: 1 offline success! 
@kols
kols / -
Created March 5, 2015 10:14
Installing collected packages: thriftpy, eleme-zeus-client, cython
Running setup.py install for thriftpy
/srv/virtualenvs/earthshakerenv/local/lib/python2.7/site-packages/setuptools/dist.py:293: UserWarning: The version specified ('0.1.15.tracking') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
building 'thriftpy.transport.cytransport' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c thriftpy/transport/cytransport.c -o build/temp.linux-x86_64-2.7/thriftpy/transport/cytransport.o
x86_64-linux-gnu-gcc: error: thriftpy/transport/cytransport.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
#!/usr/local/bin/python
import json
import sys
import keyring
import requests
APP_NAME = 'jira'
USERNAME = 'qilong.dou'
@kols
kols / master.vim
Created January 30, 2014 16:35 — forked from gmccreight/master.vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@kols
kols / index.coffee
Created July 11, 2013 15:08
upyun node.js lib concept
request = require "request"
url = require 'url'
fs = require 'fs'
path = require 'path'
crypto = require 'crypto'
UPYUN_API_HOSTS =
AUTO: "v0.api.upyun.com"
TELECOM: "v1.api.upyun.com"
NETCOM: "v2.api.upyun.com"
@kols
kols / ejabberd.plist
Last active December 16, 2015 05:09
launchd.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyL
ist-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>