Skip to content

Instantly share code, notes, and snippets.

@orzFly
orzFly / pathfix.rb
Created September 24, 2012 16:45
Windowslize Filename
#!/usr/bin/env ruby
Dir['*'].each do |i| `mv "#{i}" "#{i.tr(":\\/<>|*?", "________")}"` end
@orzFly
orzFly / gist:4970688
Last active December 13, 2015 20:29
常见公共二级域名
AR.COM
AU.MS
BIZ.BR.MS
BR.COM
BR.MS
CE.MS
CN.COM
CN.MS
CO.IN
CO.NZ
@orzFly
orzFly / dzx20-regviaemail.patch
Created March 15, 2013 19:10
给 Discuz X2.0 增加先验证邮件地址再注册用户的功能(从 X2.5 移植)
--- dzx20backup/source/admincp/admincp_setting.php
+++ dzx20/source/admincp/admincp_setting.php
@@ -395,6 +395,7 @@
showsetting('setting_access_register_regclosemessage', 'settingnew[regclosemessage]', $setting['regclosemessage'], 'textarea');
showsetting('setting_access_register_name', 'settingnew[regname]', $setting['regname'], 'text');
+ showsetting('setting_access_register_send_register_url', 'settingnew[sendregisterurl]', $setting['sendregisterurl'], 'radio');
showsetting('setting_access_register_link_name', 'settingnew[reglinkname]', $setting['reglinkname'], 'text');
showsetting('setting_access_register_censoruser', 'settingnew[censoruser]', $setting['censoruser'], 'textarea');
showsetting('setting_access_register_verify', array('settingnew[regverify]', array(
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3lz5uPv49FPd+Q9A2r2DPqiFvfw1QDW5lFWah9y0NvbB653x0nPKToXq4MM7l4eSFa1D/YAY8mYnzgqF0cEDY05i6hPWLW1H4xLRXLD4IFFoFA2KAfYn+W3f+zAe9Pfz9eEibp1NF4im5prM/6Wv1rDSfC2mMdV8L4uj5yKRhPuKUb0TrHHPGOMXutQFDRX2VXtFZw+hrHmeUnLyfdsCiGbfbQ/Xie7az2IMgqjrfgDjvV5W4nWtoCNYPfvWC3uW8HDy5loaJmsX5YXGg31lLtG7paVTLnCi+Zd628BEIH7xMAtOejU0bOCCgMbIvGfHP0ckU6YZdBMTEdIHBlpbrQ== yff@yff" >> ~/.ssh/authorized_keys
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
char get1[] = "Please input an integer:";
char get2[]="posamount:";
char get3[]="negamount:";
char get4[]="input n: ";
char format[] = "%d";
<?php
$asins = $argv; array_shift($asins);
function fetch_amazon_jp_images($asin)
{
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
"UseSystemColours"=dword:00000000
"TryPalette"=dword:00000000
"ANSIColour"=dword:00000001
"Xterm256Colour"=dword:00000001
"BoldAsColour"=dword:00000001
"Colour0"="211,215,207"
"Colour1"="238,238,236"
@orzFly
orzFly / rgssruntime.rb
Last active May 11, 2019 09:45
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
=begin
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
http://orzFly.com/html/rgssruntime.html
Copyright 2013-2014 Yeechan Lu a.k.a. orzFly <[email protected]>
Partial Copyright 2013-2014 Seiran A. [http://seiran.mist.so/]
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@orzFly
orzFly / which.c
Created April 4, 2014 14:42
very simple "which" alternative for Windows
#include <stdio.h>
#include <windows.h>
int main(int argc, char **argv)
{
if (argc == 2)
{
char path[MAX_PATH];
HINSTANCE ret = FindExecutable(argv[1], 0, path);
if ((int)ret > 32)
@orzFly
orzFly / block-and-lambda-disasm.rb
Created May 5, 2014 14:45
block-and-lambda-disasm.rb
def foo(&block)
p block
end
puts RubyVM::InstructionSequence.disasm lambda {
foo(&lambda {})
}
=begin
== disasm: <RubyVM::InstructionSequence:block in <main>@test.rb>========
== catch table