Skip to content

Instantly share code, notes, and snippets.

View cncolder's full-sized avatar
:octocat:
What Does The Cat Say?

Yanlin Jiang cncolder

:octocat:
What Does The Cat Say?
View GitHub Profile
@cncolder
cncolder / loop summary ics file for google calendar.rb
Created March 17, 2010 01:48
Exec in TextMate. Product an .ics format that loop 'summary' from 'start' to 'days'.
require 'date'; start,days,summary = DateTime.new(2010,1,1),76,'到'; puts %{BEGIN:VCALENDAR\nPRODID:-//Google Inc//Google Calendar 70.9054//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nX-WR-TIMEZONE:UTC\nX-WR-CALDESC:}; days.times { puts %{BEGIN:VEVENT\nDTSTART;VALUE=DATE:#{start.strftime('%Y%m%d')}\nDTEND;VALUE=DATE:#{start = start.next; start.strftime('%Y%m%d')}\nSUMMARY:#{summary}\nEND:VEVENT} }; puts %{END:VCALENDAR}
File.open("/etc/bootpd.plist", "r+") do |f|
while l = f.gets
if l =~ /detect_other_dhcp_server/
puts "disable dhcp detect at line : #{f.lineno}"
f.puts "\t<integer>0</integer>\n"
end
end
end
pid = `ps -e | grep bootpd | grep -v grep | awk '{print $1}'`
puts "tell bootpd reload configure : #{Process.kill('HUP', pid.to_i)}}"
May 12 14:20:39 mes servermgrd[7658]: servermgr_ipfilter:ipfw config:Notice:Flushed IPv4 rules
May 12 14:20:39 mes servermgrd[7658]: servermgr_ipfilter:ipfw config:Notice:Flushed IPv6 rules
May 12 14:20:39 mes com.apple.launchd[1] (com.apple.servermgrd[7658]): Job appears to have crashed: Segmentation fault
May 12 14:20:39 mes com.apple.launchd[1] (com.apple.servermgrd): Throttling respawn: Will start in 9 seconds
May 12 14:20:39 mes com.apple.ReportCrash.Root[7607]: 2010-05-12 14:20:39.824 ReportCrash[7607:440b] Saved crash report for servermgrd[7658] version ??? (???) to /Library/Logs/DiagnosticReports/servermgrd_2010-05-12-142039_localhost.crash
# 查看NAT服务配置
$ sudo serveradmin settings nat
nat:reverse = no
nat:unregistered_only = yes
nat:same_ports = yes
nat:natportmap_interface = "en0"
nat:log = yes
nat:clamp_mss = yes
nat:dynamic = yes
nat:log_denied = no
# 试着改回正常值
$ sudo serveradmin settings nat:natportmap_interface = "en1"
nat:natportmap_interface = "en1"
$ sudo serveradmin settings nat:interface = "en0"
nat:interface = "en0"
# 等10秒看看servermgrd起来没
$ ps aux | grep servermgrd | grep -v grep
root 7687 0.0 0.2 2577788 38484 ?? Ss 2:20PM 0:03.57 servermgrd -x
<s:List dragEnabled="true" dragMoveEnabled="true">
<s:dataProvider>
<s:ArrayCollection>
<fx:Object label="Item one"/>
<fx:Object label="Item two"/>
<fx:Object label="Item three"/>
</s:ArrayCollection>
</s:dataProvider>
</s:List>
<html>
<head>
<title>IE PNG Alpha Fix</title>
<style type="text/css">
img { behavior: url("iepngfix.htc") }
</style>
</head>
<body bgcolor="#000000">
<img src="opacity.png"/>
</body>
# Print "colder"
(_=%!%!<<(?#+?@))&&_%(?#+?@)+_%(?/+?@)+_%(?,+?@)+_%(?$+?@)+_%(?%+?@)+_%(?#+?%+?*)
<!-- Rails html5 templete -->
<%= link_to "Add user", new_user_path, :remote => true %>
<!-- Will product -->
<a href="/users/new" data-remote="true">Add user</a>
// Live is new method in jQuery 1.4+.
$('a[data-confirm]').live('click', function () { ... });
// When user click the link. jQuery will handle it and send a ajax request.
$.ajax({
url: "/users/new",
dataType: "script",
...
});