This file contains 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 torch | |
torch.Tensor(1).cuda() | |
print("hello world!") | |
f = open("demofile2.txt", "a") | |
f.write("Now the file has more content!") | |
f.close() |
This file contains 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 static byte[] iv = "0000000000000000".getBytes(); | |
private static String decrypt(String encrypted, String seed) | |
throws Exception { | |
byte[] keyb = seed.getBytes("utf-8"); | |
MessageDigest md = MessageDigest.getInstance("SHA-256"); | |
byte[] thedigest = md.digest(keyb); | |
SecretKeySpec skey = new SecretKeySpec(thedigest, "AES"); | |
Cipher dcipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
dcipher.init(Cipher.DECRYPT_MODE, skey, new IvParameterSpec(iv)); | |
byte[] clearbyte = dcipher.doFinal(Base64.decode(encrypted, Base64.DEFAULT)); |
This file contains 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
venv: venv/bin/activate | |
venv/bin/activate: requirements.txt | |
test -d venv || virtualenv venv | |
venv/bin/pip install -Ur requirements.txt | |
touch venv/bin/activate | |
clean: venv | |
venv/bin/pip freeze | grep -v -f requirements.txt - | grep -v '^#' | xargs venv/bin/pip uninstall -y | |
freeze: venv |
This file contains 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
# Clean, simple, compatible and meaningful. | |
# Tested on Linux, Unix and Windows under ANSI colors. | |
# It is recommended to use with a dark background and the font Inconsolata. | |
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | |
# Machine name. | |
local platform=`uname` | |
local ipaddr=$HOST | |
if [[ "$platform" == "Darwin" ]]; then | |
ipaddr=$(ipconfig getifaddr en0) |
This file contains 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 urllib.request | |
import asyncio | |
import json | |
r = urllib.request.urlopen('https://raw.githubusercontent.com/spacelan/wechat-emoticon/master/emoticons.json').read().decode('utf8') | |
json_obj = json.loads(r) | |
@asyncio.coroutine | |
def download(todo): | |
urllib.request.urlretrieve(todo.get('url'), todo.get('md5') + '.gif') |
This file contains 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
# 批量装文件夹下apk | |
for f in *.apk ; do adb install -r $f; done; |
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<resources> | |
<color name="white">#FFFFFF</color><!--白色 --> | |
<color name="ivory">#FFFFF0</color><!--象牙色 --> | |
<color name="lightyellow">#FFFFE0</color><!--亮黄色 --> | |
<color name="yellow">#FFFF00</color><!--黄色 --> | |
<color name="snow">#FFFAFA</color><!--雪白色 --> | |
<color name="floralwhite">#FFFAF0</color><!--花白色 --> | |
<color name="lemonchiffon">#FFFACD</color><!--柠檬绸色 --> | |
<color name="cornsilk">#FFF8DC</color><!--米绸色 --> |
This file contains 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
mac 硬盘测速 | |
time dd if=/dev/zero bs=1024k of=tstfile count=1024 | |
time dd if=tstfile bs=1024k of=/dev/null count=1024 | |
显示:defaults write com.apple.finder AppleShowAllFiles -bool true | |
隐藏:defaults write com.apple.finder AppleShowAllFiles -bool false |
This file contains 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
adb logcat -b main -b radio -b events -v time>test.log |
This file contains 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
netsh wlan set hostednetwork mode=allow ssid="wifi hotspot name" key="wifi password" | |
netsh wlan start hostednetwork |
NewerOlder