This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -w | |
def presskey(keycode) | |
system "osascript -e 'tell application \"System Events\" to key code #{keycode}'" | |
end | |
kVK_LeftArrow = 123 | |
kVK_RightArrow = 124 | |
kVK_DownArrow = 125 | |
kVK_UpArrow = 126 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo find ./ -name ".DS_Store" -depth -exec rm -f {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :cors_set_access_control_header | |
# other staff | |
private | |
def cors_set_access_control_header | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' | |
headers['Access-Control-Request-Method'] = '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# coding: utf-8 | |
require 'uri' | |
require 'iconv' | |
require 'open-uri' | |
if $0 == __FILE__ | |
url = 'http://jingdian.tuniu.com/fengjing/' | |
num = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# coding: utf-8 | |
require 'uri' | |
#require 'iconv' | |
require 'open-uri' | |
require 'thread' | |
def scrape(from,to,n) | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -w | |
require 'rexml/document' | |
include REXML | |
xmlfile = File.new("tour_treepath_area.xml") | |
xmldoc = Document.new(xmlfile) | |
root = xmldoc.root | |
#puts root.attributes["ver"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ===================================================================================== | |
* | |
* Filename: mutex_semaphore.c | |
* | |
* Description: use peterson method to implement semaphore | |
* | |
* Version: 1.0 | |
* Created: 04/16/2013 03:27:04 PM | |
* Revision: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
require 'RMagick' | |
include Magick | |
animation = ImageList.new(*Dir["*.png"]) | |
animation.delay = 10 | |
animation.write("animated.gif") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -w | |
def presskey(keycode) | |
system "osascript -e 'tell application \"System Events\" to key code #{keycode}'" | |
end | |
kVK_LeftArrow = 123 | |
kVK_RightArrow = 124 | |
kVK_DownArrow = 125 | |
kVK_UpArrow = 126 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 7 columns, instead of 4. in line 6.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reporting_campaign,da😄te,group,cre*&ative,type,na^$%me,valu()e | |
Belsomra-Q1-2016,2016-02-08,desktop,Always Awake? | Get The Information You Need To | Help Aid Your Insomnia Symptoms. | www.help-treat-insomnia.com,metric,Clicks,0 | |
Belsomra-Q1-2016,2016-02-08,desktop,Always Awake? | Get The Information You Need To | Help Aid Your Insomnia Symptoms. | www.help-treat-insomnia.com,metric,Impressions,15 | |
Belsomra-Q1-2016,2016-02-08,desktop,Can't Sleep At Night? | Find Answers To Common Questions & | Learn About A Treatment Option Here | www.help-treat-insomnia.com,metric,Clicks,0 | |
Belsomra-Q1-2016,2016-02-08,desktop,Can't Sleep At Night? | Find Answers To Common Questions & | Learn About A Treatment Option Here | www.help-treat-insomnia.com,metric,Impressions,6 | |
Belsomra-Q1-2016,2016-02-08,desktop,Can't Sleep At Night? | Find Information About Insomnia | & A Treatment Option Today. | www.help-treat-insomnia.com,metric,Clicks,0 | |
Belsomra-Q1-2016,2016-02-08,desktop,Can't Sleep At Night? | Find Information About |
OlderNewer