- List resources filter with specified pattern
gcloud alpha resources list --filter='utopian-theater-20112'
gcloud alpha resources list --filter='utopian-theater-20112'
Optional = Struct.new(:value) do | |
def and_then(&block) | |
if value.nil? | |
Optional.new(nil) | |
else | |
block.call(value) | |
end | |
end | |
def method_missing(*args, &block) |
# lambda recusion. | |
puts ->() { | |
error = ->(n) {throw "SHOULD NEVER BE CALLED"} | |
->(g) { | |
g.(g) | |
}.( | |
->(f) { | |
->(n) {n.zero? ? 1 : n * f.(f).(n-1)} | |
} |
def dump_speed_matrix(): | |
Fi = [ 372, 372, 558, 744, 1116, 1488, 1860, "RFU", "RFU", 512, 768, 1024, 1536, 2048, "RFU", "RFU"] | |
FMax = [ 4, 5, 6, 8, 12, 16, 20, "RFU", "RFU", 5, 7.5, 10, 15, 20, "RFU", "RFU"] | |
Di = ["RFU", 1, 2, 4, 8, 16, 32, 64, 12, 20, "RFU", "RFU", "RFU", "RFU", "RFU", "RFU"] | |
for fi in [0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13]: | |
for di in [1, 2, 3, 4, 5, 6, 7, 8, 9]: | |
v = Fi[fi] / Di[di] | |
text = "Fi=%2s(%4d), Di=%2s(%2d), %4g cycles/ETU (%7d bits/s at 3.57 MHz, %7d bits/s for fMax=%4.1f MHz)" | |
args = (fi, Fi[fi], di, Di[di], v, 3570000 / v, FMax[fi] * 1000000 / v, FMax[fi]) |
;;;; http://stuartsierra.com/2010/01/05/taming-the-gridbaglayout | |
(import '(javax.swing JFrame JPanel JButton JOptionPane JLabel)) | |
(import 'java.awt.event.ActionListener) | |
(import '(java.awt GridBagConstraints GridBagLayout Insets)) | |
;;; | |
(comment | |
(def button (JButton. "Click Me!")) | |
(def panel (doto (JPanel.) |
#!/usr/bin/python | |
from string import ascii_uppercase | |
from sys import argv | |
from os.path import splitext | |
from openpyxl import Workbook, load_workbook | |
S_KEY_COL = "A" | |
L_COLS_FILL = ["C", "D"] | |
N_ROW_START = 15 |
#!/usr/bin/python | |
import sys | |
comp_tag_names = [ | |
"None", | |
"Header", # 1 | |
"Directory", # 2 | |
"Applet", # 3 | |
"Import", # 4 | |
"ConstantPool", # 5 |
var arrays = [ | |
[1, 4, 6, 123, 78, 8, 9, 124, 44], | |
[44, 6, 9, 123], | |
[124, 44, 16, 9, 123] | |
] | |
function findCommonElements(arrays) { | |
var sorted_arr = arrays.map(function(arr) { | |
// sort and remove duplicated elements in each array. | |
return arr.sort(function (a, b) {return a - b; }).reduce(function (r_arr, ele) { |