This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hello, World! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "io/ioutil" | |
| "log" | |
| "net" | |
| "net/http" | |
| "net/url" | |
| "strings" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bytes" | |
| "crypto/tls" | |
| "encoding/binary" | |
| "encoding/hex" | |
| "encoding/json" | |
| "io" | |
| "log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func callA() string { | |
| time.Sleep(time.Millisecond * 300) | |
| return "Hello A" | |
| } | |
| func callB() string { | |
| time.Sleep(time.Millisecond * 100) | |
| return "Hello B" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PriorityTaskExecutor extends ThreadPoolExecutor { | |
| public PriorityTaskExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) { | |
| super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); | |
| } | |
| public <T> List<Future<T>> invokeAllWithPriority(Collection<? extends Callable<T>> tasks, | |
| long timeout, TimeUnit unit) | |
| throws InterruptedException { | |
| if (tasks == null || unit == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env php | |
| <?php | |
| function fetch_page($url, $timeout = 5) { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
| $data = curl_exec($ch); | |
| curl_close($ch); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "log" | |
| "os" | |
| ) | |
| type Result struct { | |
| WeatherInfo *WeatherInfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| LOCATION='' | |
| API_KEY='' | |
| FEED_ID='' | |
| #################################################### | |
| COSM_URL=http://api.cosm.com/v2/feeds/$FEED_ID?timezone=+8 | |
| cpu_load=`cat /proc/loadavg | awk '{print $2}'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.hugozhu.thread_wait_for_another_s_signal; | |
| import java.util.concurrent.CountDownLatch; | |
| import java.util.concurrent.locks.Condition; | |
| import java.util.concurrent.locks.Lock; | |
| import java.util.concurrent.locks.ReentrantLock; | |
| /** | |
| * 线程等待依赖服务初始化成功 (for android) | |
| * User: hugozhu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "os" | |
| "runtime" | |
| "log" | |
| "time" | |
| ) | |
| var dir string |
OlderNewer