Skip to content

Instantly share code, notes, and snippets.

def measure_palindrome(prefix,postfix):
i=0
while i<len(prefix) and i<len(postfix):
if prefix[-i-1]!=postfix[i]:
break
i+=1
return i
def longest_palindrome(s):
longest=""
@changtimwu
changtimwu / fissiontrigger_foraws.md
Created May 26, 2018 07:40
Analogy of Fission triggers for AWS users
  • HTTP triggers (routes) -> API gateway
  • Time triggers (timers) -> Scheduled Events
  • message queue triggers -> SQS
@changtimwu
changtimwu / btcmerkle.ts
Created March 13, 2018 10:02
validate latest bitcoin block's hash of merkle root
import fetch from 'node-fetch'
import * as crypto from 'crypto'
let sha256 = (x: Buffer): Buffer =>
crypto.createHash('sha256').update(x).digest()
interface UTXO_IN {
sequence: number
witness: string
script: string
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Try Comix</tspan>
</label>
@changtimwu
changtimwu / greeter.ts
Created July 6, 2017 18:45
some ts example
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
@changtimwu
changtimwu / cisco_acs.md
Last active June 18, 2016 04:19
Setup TACACS+ between LANTECH switch and Cisco ACS
@changtimwu
changtimwu / vuestudy.md
Last active June 15, 2016 05:29
VUE survey and study

as title

@changtimwu
changtimwu / gocliex.md
Last active March 4, 2016 02:50
go multisession CLI scratch