Skip to content

Instantly share code, notes, and snippets.

View lemonlatte's full-sized avatar

Jim Yeh lemonlatte

  • Taipei, Taiwan
  • 19:19 (UTC +08:00)
View GitHub Profile
@lemonlatte
lemonlatte / k8s-cert-manager-install.sh
Created August 20, 2018 06:02
Install cert manager in k8s with rbac
kubectl create serviceaccount -n kube-system tiller
kubectl create clusterrolebinding tiller-binding --clusterrole=cluster-admin --serviceaccount kube-system:tiller
helm init --upgrade --service-account tiller
helm upgrade cert-manager stable/cert-manager --set rbac.create=true
@lemonlatte
lemonlatte / hexToString.js
Created August 13, 2018 03:54
hex to string in JS
function hexToString (hex) {
var string = '';
for (var i = 0; i < hex.length; i += 2) {
string += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
}
return string;
}
@lemonlatte
lemonlatte / encode.sh
Last active July 16, 2018 08:28
OP_HASH160
echo -n '63a6142c5b442dcfd70ed65b9c90956844525527d9ab3c8876a9143aa29799bae62940f3235cc58e0420359aa0fdf867041b87c659b17576a91470d0975d5053bc3291e0bad4c08d88e41d9ef5366888ac' \
| xxd -r -p | openssl dgst -sha256 | xxd -r -p | openssl dgst -ripemd160
@lemonlatte
lemonlatte / envelope_encryption.go
Created February 7, 2018 16:48 — forked from andreas/envelope_encryption.go
Envelope Encryption with Amazon KMS and Go
package main
import (
"bytes"
"crypto/rand"
"encoding/gob"
"fmt"
"io/ioutil"
"os"
"time"
var oraclize paypal example:paypalexampleContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"payment_id","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"requestNewPayment","outputs":[],"payable":true,"type":"function"},{"inputs":[],"payable":true,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"payment_id","type":"string"}],"name":"newPaymentReceived","type":"event"}]);
var oraclize paypal example:paypalexample = oraclize paypal example:paypalexampleContract.new(
{
from: web3.eth.accounts[0],
data: '0x60606040525b620000236200002a64010000
@lemonlatte
lemonlatte / bytes32ToString.sol
Created December 26, 2017 02:17
Ethereum Libraries
library strings {
function bytes32ToString(bytes32 s) returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = s[j];
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
@lemonlatte
lemonlatte / gist:265f1afbd0ab964a2164dc58513c7d9e
Created December 21, 2017 17:54 — forked from thefella/gist:3431023
Favicons, mobile icons and launch screens
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png">
<link rel="icon" type="image/png" href="/apple-touch-icon-57x57-precomposed.png">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-startup-image" media="only screen and (max-device-width: 480px) and not (-webkit-min-device-pixel-ratio: 2)" href="/apple-touch-startup-image-320x460.png">
<link rel="apple-touch-startup-image" media="only screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="/apple-touch-startup-image-640x920.png">
<link rel="apple-touch-startup-image" media="only screen and (min-device-width: 768px) and (orientation: portrait)" href="/apple-touch-
import os
for root, dirs, files in os.walk("/var/lib/assets"):
for f in files:
try:
print(f)
except:
os.rename(root + '/' + f, root + "/renamed-file")
print(root, files)
@lemonlatte
lemonlatte / ETH Kovan Address
Last active November 26, 2017 13:47
kovan address
0xc736636767D7EeA9C1A63C771C109FD0d8E9dBa5
apiVersion: v1
kind: ConfigMap
metadata:
name: example-config
data:
example.conf: |
{
"host": "localhost"
}
---