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
item_names = mydict["items"].split() | |
if len(item_names) > 1: | |
item_names[-1] = "and " + dv_tiers[-1] | |
sep = ", " if len(item_names) > 2 else " " | |
namstr = sep.join(item_names) | |
print namestr # a, b and c |
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
import hudson.model.* | |
def str_view = "AIR_Project_A630" | |
def str_search = "air_a630" | |
def str_replace = "air_a630v1" | |
def view = Hudson.instance.getView(str_view) | |
//copy all projects of a view | |
for(item in view.getItems()) |
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
require 'pg' | |
require 'json' | |
def db_connect(host, dbname, user, password) | |
begin | |
conn = PGconn.connect(host, 5436, '', '', dbname, user, password) | |
rescue | |
puts "Failed to connect to database #{dbname} on #{host}" | |
end | |
return conn |
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
import sqlite3 | |
conn = sqlite3.connect('emaildb.sqlite') # create a database is not exist | |
cur = conn.cursor() | |
cur.execute(''' | |
DROP TABLE IF EXISTS Counts''') # three quotes support multiple lines without \n | |
cur.execute(''' | |
CREATE TABLE Counts (org TEXT, count INTEGER)''') |
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
<a class="post-overlay" href="http://carmentang.co/callahan-realty-group/" rel="bookmark" title="Callahan Realty Group"> | |
<p class="view">View →</p> | |
</a> | |
.posts .post .post-overlay, .post-navigation a, .post-navigation a p { | |
-webkit-transition: all 0.4s ease-in-out; | |
-moz-transition: all 0.4s ease-in-out; | |
-ms-transition: all 0.4s ease-in-out; |
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
_ |
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
CREATE VIEW air_a630_g3_latest_compiler_release AS SELECT * FROM air_promote_records WHERE project = 'a630' AND air_group = 3 AND component = 'compiler' AND status_info = 'REL_DONE' AND air_promote_vid > (SELECT MAX(air_promote_vid) FROM air_promote_records WHERE project = 'a630' AND air_group = 3 AND component = 'compiler' AND status_info = 'REL_USED' ) ORDER BY air_promote_vid ASC LIMIT 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
if @env_os == 'windows' | |
@scandir = self.scandir.gsub(/\\/, '/') | |
else | |
@scandir = self.scandir | |
end | |
all_full_rels = Dir["#{@scandir}/*"] | |
all_rels = [] | |
all_full_rels.each do |frel| | |
if is_dir_exist(frel) | |
t_rel = File.basename(frel).gsub(/\/$/, '') |
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
name = raw_input("Enter file:") | |
if len(name) < 1 : name = "mbox-short.txt" | |
handle = open(name) | |
hours = dict() | |
for line in handle.readlines(): | |
if line.startswith('From '): | |
h = line.split(' ')[6].split(':')[0] | |
hours[h] = hours.get(h, 0) + 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
name = raw_input("Enter file:") | |
if len(name) < 1 : name = "mbox-short.txt" | |
handle = open(name) | |
email = dict() | |
for line in handle.readlines(): | |
if line.startswith('From '): | |
addr = line.split(' ')[1] | |
email[addr] = email.get(addr, 0) + 1 |