Skip to content

Instantly share code, notes, and snippets.

import struct
import StringIO
import binascii
import zlib
import datetime
def deflate(data, compresslevel=9, flush_mode=zlib.Z_FINISH):
compress = zlib.compressobj(
compresslevel, # level: 0-9
require "google_drive"
session = GoogleDrive.saved_session
spreadsheet = session.spreadsheet_by_url("https://docs.google.com/spreadsheets/d/1ScxgwUUrXOtvxw4eqhoR6pMkEdC4oYM3zOjq_6gZAAc/edit#gid=0")
ws = spreadsheet.worksheets[0]
start_time = Time.now
ws.cells
end_time = Time.now
puts("Took %f secs." % (end_time - start_time))
@gimite
gimite / designer.html
Created August 19, 2014 14:18
designer
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
import scala.collection.mutable.ArrayBuffer
import scala.io.Source
object ShantenAnalysis {
val NUM_PIDS = 9 * 3 + 7
var mentsus:ArrayBuffer[Array[Int]] = null
def main(args: Array[String]) {
mentsus = createMentsus()
#!/usr/bin/env ruby
# coding: utf-8
require "rubygems"
require "tilt"
require "tempfile"
f = Tempfile.open("template")
f.puts('<%# coding: UTF-8 %>')
f.puts('ふが <%= @hoge %>')
@gimite
gimite / Records history of memory consumption of specific process with given pid
Created January 18, 2010 10:07
Records history of memory consumption of specific process with given pid
require "enumerator"
$stdout.sync = true
while true
line = `ps auxww`.enum_for(:each_line).grep(/^\S+\s+#{ARGV[0]}\s+/)[0]
break if !line
puts(Time.now.to_s() + " " + line)
sleep(10)
end
# Workaround code to solve garbled text issue in appengine-jruby from
# http://d.hatena.ne.jp/yune_kotomi/20090922/1253627829
module AppEngine
module Datastore
def Datastore.ruby_to_java(value) # :nodoc:
if SPECIAL_RUBY_TYPES.include? value.class
value.to_java
else
case value
import java.util.Timer;
import java.util.TimerTask;
import android.app.Service;
import android.os.Handler;
public class MyService extends Service {
private Handler handler = new Handler();
private Timer timer;
--- setup.rb.orig Mon Jul 20 21:29:03 2009
+++ setup.rb Mon Jul 20 21:28:21 2009
@@ -1457,14 +1457,9 @@
return
end
$stderr.puts 'Running tests...' if verbose?
- begin
- require 'test/unit'
- rescue LoadError
- setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
#!/usr/bin/env python
# Copyright (c) 2009, Shinichiro Hamaji
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.