Skip to content

Instantly share code, notes, and snippets.

@jimhorng
jimhorng / CF app cannot start
Last active December 27, 2015 08:59
CF app cannot start
-----
>cf restart hello
Stopping hello... OK
Preparing to start hello... OK
Checking status of app 'hello'...
0 of 1 instances running (1 starting)
0 of 1 instances running (1 down)
0 of 1 instances running (1 down)
@jimhorng
jimhorng / gist:594401f68ce48282ced5
Last active August 10, 2017 07:49
Script to test PyAPNS
'''
Created on Mar 10, 2014
@author: jimhorng
'''
from apns import APNs, Payload
import time
import logging
import sys
@jimhorng
jimhorng / gist:e8336178ad6acbe36d76
Last active August 29, 2015 14:22
dot format to dict
def gen_dict(key_tree, value):
if len(key_tree) == 1:
return "%s = \"%s\";" %(key_tree[0], value)
else:
return (gen_dict(key_tree[1:], value) +
"\n" + "{key1} = {{}};\n{key1}['{key2}'] = {key2};".format(key1=key_tree[0],
key2=key_tree[1]))
print gen_dict(key_tree="a.b.c.d".split("."), value="haha")
# input: a.b.c.d = "haha"
@jimhorng
jimhorng / test.go
Last active April 20, 2016 08:04
golang goroutine example
func makeThumbnails6(filenames <-chan string) int64 {
sizes := make(chan int64)
var wg sync.WaitGroup // number of working goroutines
for f := range filenames {
wg.Add(1)
// worker
go func(f string) {
defer wg.Done()
thumb, err := thumbnail.ImageFile(f)
Please let me know if you or your friends are interested in this position, thanks :)
✔ Company: Digital River https://www.104.com.tw/jobbank/custjob/index.php?r=cust&j=384a426d3c463f6952583a1d1d1d1d5f2443a363189j56
✔ Title: Principal Software Engineer
✔ Mission:
Build End-to-End Large-scale Machine Learning Systems for improving value proposition for E-commerce. e.g. Increase payment success rate, Fraud detection, Resource utilizations
✔ Package: Negotiable, can up to 2-2.5M
@jimhorng
jimhorng / day_24_part1.py
Created December 30, 2022 11:02
adventofcode day 24
class Solution:
def day24(self, input: str) -> int:
def input_to_state(input):
input = input.strip()
grid = []
for line in input.split("\n"):
row = []
for c in line:
if c == '.':
@jimhorng
jimhorng / 2812. Find the Safest Path in a Grid.java
Last active August 16, 2023 13:02
2812. Find the Safest Path in a Grid
import java.util.*;
public class Solution {
private int nr, nc;
public int maximumSafenessFactor(List<List<Integer>> grid) {
nr = grid.size();
nc = grid.get(0).size();