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
DATE_FORMATTER = '%Y-%m-%d %H:%M:%S' | |
def unix_time(dt): | |
epoch = datetime.utcfromtimestamp(0) | |
delta = dt - epoch | |
return delta.total_seconds() | |
def unix_time_millis(dt): | |
return unix_time(dt) * 1000.0 |
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
static $periods = array( | |
'天' => 86400, | |
'小时' => 3600, | |
'分钟' => 60, | |
'秒' => 1 | |
); | |
public function friendlyTime($timestamp) | |
{ | |
$timeStr = ''; |
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
# -*- coding: utf-8 -*- | |
date.today().strftime(u'%Y年%m月%d日'.encode('utf-8')).decode('utf-8') | |
#输出:2012年11月27日 |
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 | |
kill -sighup `ps -e | grep Finder.app | grep -v grep | cut -c1-6` |
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
private void logBatteryInfoByApi() { | |
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); | |
Intent batteryStatus = MainActivity.this.registerReceiver(null, ifilter); | |
assert batteryStatus != null; | |
Log.e(LOG_TAG, "STATUS: " + String.valueOf(batteryStatus.getIntExtra(BatteryManager | |
.EXTRA_STATUS, -1))); | |
Log.e(LOG_TAG, "PLUG: " + String.valueOf(batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, | |
-1))); | |
Log.e(LOG_TAG, "LEVEL: " + String.valueOf(batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, |
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
import org.eclipse.jetty.util.ConcurrentHashSet; | |
import java.util.*; | |
import java.util.function.Function; | |
import java.util.stream.Collectors; | |
import io.reactivex.Observable; | |
import static java.util.Comparator.comparing; |
OlderNewer