Skip to content

Instantly share code, notes, and snippets.

use std::fs::File;
use std::path::Path;
use std::io::BufReader;
use std::io::BufRead;
use std::collections::HashMap;
use std::io::stdin;
fn sort_str(s: &String) -> String {
let mut v: Vec<char> = s.chars().collect();
v.sort();
@ahl
ahl / gist:88a5955949477d69662eff397e665dfe
Last active March 20, 2021 19:26
Python used to be a joke (1998) alt.humor.best-of-usenet 1998/09/27 Re: Perl & Java - differences and uses
From: Dan Cosley <d...@atools.cs.jmu.edu>
Subject: [comp.lang.java.programmer] Re: Perl & Java - differences and uses
Date: 1998/09/27
Message-ID: <ahbou=6tk9fo$hvg@enews2.newsguy.com>#1/1
X-Deja-AN: 395199212
Approved: ahbo...@acpub.duke.edu
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply approval of content. See .sig below.
X-Posting-Moderator: bogrow
X-For-FAQ-Mailto: ahbo...@eey.org
X-FAQ-Is-At: ftp://rtfm.mit.edu/pub/faqs/best-of-usenet-humor
@ahl
ahl / nomsfs initial schema
Last active August 8, 2016 21:35
nomsfs blog: initial (bad) schema
struct Filesystem {
inodes: Map<Number, struct Inode {
attr: struct Attr { /* e.g. permissions, modification time, etc. */ }
contents: Union {
struct File { data: Ref<Blob> /* Noms pile of bytes */ } |
struct Directory { contents: Map<String, Number> }
}
}>
rootInode: Number
maxInode: Number
@ahl
ahl / nomsfs final schema
Last active August 8, 2016 21:33
nomsfs blog: final schema
struct Filesystem {
root: struct Inode {
attr: struct Attr { /* e.g. permissions, modification time, etc. */ }
contents: Union {
struct File { data: Ref<Blob> /* Noms pile of bytes */ } |
struct Directory: { contents: Map<string, Cycle<1>> }
}
}
}
@ahl
ahl / mkdir.go
Created August 7, 2016 03:37
nomsfs blog: mkdir.go
func (fs *nomsFS) mkdir(dir types.Struct, pathComponents []string) types.Struct {
if len(pathComponents) > 0 {
name := pathComponents[0]
return dir.Set(name, fs.mkdir(dir.Get(name).(types.Struct), pathComponents[1:]))
} else {
return types.NewStructWithType(directoryType, types.ValueSlice{types.NewMap()})
}
}
@ahl
ahl / gist:d7f895884600ce515fad9e133db92c29
Created June 26, 2017 21:43
null_resource does not have triggers attribute [full]
This file has been truncated, but you can view the full file.
2017/06/26 14:36:23 [INFO] Terraform version: 0.9.8 8d560482c34e865458fd884cb0790b4f73f09ad1+CHANGES
2017/06/26 14:36:23 [INFO] Go runtime version: go1.8
2017/06/26 14:36:23 [INFO] CLI args: []string{"/Users/ahl/gosrc/bin/terraform", "plan", "-out=todo", "-refresh=false"}
2017/06/26 14:36:23 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:36:23 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:36:23 [DEBUG] Attempting to open CLI config file: /Users/ahl/.terraformrc
2017/06/26 14:36:23 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/06/26 14:36:23 [INFO] CLI command args: []string{"plan", "-out=todo", "-refresh=false"}
2017/06/26 14:36:23 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:36:23 [DEBUG] command: loading backend config file: /Users/ahl/src/transposit/terraform
@ahl
ahl / gist:a3b2e553043c2634b8a84dd7d805455b
Created June 26, 2017 21:44
null_resource does not have triggers attribute [target]
2017/06/26 14:38:32 [INFO] Terraform version: 0.9.8 8d560482c34e865458fd884cb0790b4f73f09ad1+CHANGES
2017/06/26 14:38:32 [INFO] Go runtime version: go1.8
2017/06/26 14:38:32 [INFO] CLI args: []string{"/Users/ahl/gosrc/bin/terraform", "plan", "-out=todo", "-refresh=false", "-target=null_resource.svc-config"}
2017/06/26 14:38:32 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:38:32 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:38:32 [DEBUG] Attempting to open CLI config file: /Users/ahl/.terraformrc
2017/06/26 14:38:32 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/06/26 14:38:32 [DEBUG] Detected home directory from env var: /Users/ahl
2017/06/26 14:38:32 [INFO] CLI command args: []string{"plan", "-out=todo", "-refresh=false", "-target=null_resource.svc-config"}
2017/06/26 14:38:32 [DEBUG] command: loading backend config file: /Users/ahl/src/transposit/terraform
@ahl
ahl / gist:db1f84f4df6669fec9215cc0b84add10
Last active May 31, 2018 16:22
aws_service_discovery_private_dns_namespace fail
2018/05/30 09:35:34 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161+CHANGES
2018/05/30 09:35:34 [INFO] Go runtime version: go1.10.1
2018/05/30 09:35:34 [INFO] CLI args: []string{"/Users/ahl/gosrc/bin/terraform", "apply"}
2018/05/30 09:35:34 [DEBUG] Attempting to open CLI config file: /Users/ahl/.terraformrc
2018/05/30 09:35:34 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/05/30 09:35:34 [INFO] CLI command args: []string{"apply"}
2018/05/30 09:35:34 [INFO] command: empty terraform config, returning nil
2018/05/30 09:35:34 [DEBUG] command: no data state file found for backend config
2018/05/30 09:35:34 [DEBUG] New state was assigned lineage "6e082fc8-cec3-b3a6-774b-8935c5d11d44"
2018/05/30 09:35:34 [INFO] command: backend initialized: <nil>
SELECT * FROM google_hire.list_applications AS app
JOIN google_hire.list_candidates AS can
ON app.candidate = can.name
WHERE app.tenant = 'my_tenant'
AND app.filter='status.state=ACTIVE'
AND can.tenant = 'my_tenant'
AND can.filter='applications.status.state=ACTIVE’
SELECT * FROM google_hire.list_applications AS app
 JOIN google_hire.list_candidates AS can
 ON app.candidate = can.name
 WHERE app.tenant = 'my_tenant'
 AND app.filter='status.state=ACTIVE'
 AND can.tenant = 'my_tenant'
 AND can.filter='applications.status.state=ACTIVE'
 AND job = (SELECT name FROM google_hire.list_jobs
 WHERE tenant='my_tenant'
 AND filter='state=OPEN'