Skip to content

Instantly share code, notes, and snippets.

@cdfmr
cdfmr / fakecd.txt
Last active August 29, 2015 14:05
Replace RaidenII's background music playing
;跳过光盘检测
0040692D E9 C5010000 JMP 00406AF7
;初始化设备
00402F20 60 PUSHAD ;保留作案现场
00402F21 68 60324000 PUSH 00403260 ;回调函数
00402F26 FF15 74E0CB00 CALL DWORD PTR DS:[fakecd_init] ;偷梁换柱
00402F2C 83C4 04 ADD ESP,4 ;平衡堆栈
00402F2F 61 POPAD ;恢复现场
00402F30 33C0 XOR EAX,EAX ;返回值
@cdfmr
cdfmr / fakecd.cpp
Last active August 29, 2015 14:05
Replacement for RaidenII's background music playing
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include "audiere.h"
using namespace audiere;
#define FAKECD_API __declspec(dllexport)
AudioDevicePtr g_device = 0;
OutputStreamPtr g_stream = 0;
@cdfmr
cdfmr / spindown.sh
Created October 15, 2013 12:18
Spin down usb hard disk automatically if there is no activity | Depends: hdparm sdparm | Cron: */15 * * * * spindown.sh sda 10 (spin down sda if there is no activity for 10 minutes)
#!/bin/sh
DISK=sda
TIMEOUT=600
if [ $# -ge 1 ] ; then
DISK=$1
fi
if [ $# -ge 2 ] ; then
TIMEOUT=$2
@cdfmr
cdfmr / buttons
Last active December 25, 2015 14:19
Shut down WNDRMAC router running OpenWrt safely to protect usb hard disks
#!/bin/sh
# Shut down WNDRMAC router running OpenWrt safely to protect usb hard disks
# Save this script as /etc/hotplug.d/button/buttons
# Usage: press any front button for more than 2 seconds to shutdown the router
#!/bin/sh
if [ "$BUTTON" = "BTN_2" ] || [ "$BUTTON" = "wps" ] ; then
if [ "$ACTION" = "pressed" ] ; then
@cdfmr
cdfmr / panoramio.sh
Last active January 25, 2018 10:43
Download Panoramio pictures via user id
#!/bin/sh
delay=0
timeout=10
retry=2
usage()
{
echo "Usage: `basename $0` userid"
exit 1
@cdfmr
cdfmr / jandan.sh
Last active December 23, 2015 03:09
用Shell来抓取煎蛋妹子图
#!/bin/sh
delay=0
timeout=10
retry=2
usage()
{
echo "Usage: `basename $0` frompage topage"
exit 1
@cdfmr
cdfmr / NSApplication+SelfRelaunch.m
Created March 26, 2012 11:56
Self relaunch of Cocoa application
@implementation NSApplication (Relaunch)
- (void)relaunchAfterDelay:(float)seconds
{
NSTask *task = [[[NSTask alloc] init] autorelease];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:[NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, [[NSBundle mainBundle] bundlePath]]];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:args];
@cdfmr
cdfmr / SystemCodeSnippets.codesnippets
Created March 7, 2012 12:23
Xcode 4 code snippets with opening braces in new line
<?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">
<array>
<dict>
<key>IDECodeSnippetVersion</key>
<integer>1</integer>
<key>IDECodeSnippetCompletionPrefix</key>
<string>@protocol</string>
<key>IDECodeSnippetContents</key>
@cdfmr
cdfmr / xcode4_debug_authorization.diff
Created March 7, 2012 12:16
Fix debug authorization of Xcode 4 after upgrading to Lion 10.7.3
--- /etc/authorization.bak 2012-03-07 10:44:43.000000000 +0800
+++ /etc/authorization 2012-03-07 10:50:41.000000000 +0800
@@ -7568,7 +7568,7 @@
<key>allow-root</key>
<false/>
<key>class</key>
- <string>user</string>
+ <string>rule</string>
<key>comment</key>
<string>For use by Apple. WARNING: administrators are advised
@cdfmr
cdfmr / wine_fontsubstitutes_wqymicrohei.reg
Created March 1, 2012 07:01
Wine font substitutes with WenQuanYi Micro Hei font
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial"="WenQuanYi Micro Hei"
"Comic Sans MS"="WenQuanYi Micro Hei"
"Courier"="WenQuanYi Micro Hei Mono"
"Courier New"="WenQuanYi Micro Hei Mono"
"Fixedsys"="WenQuanYi Micro Hei"
"Helv"="WenQuanYi Micro Hei"
"Helvetica"="WenQuanYi Micro Hei"