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
#!/bin/bash | |
echo "Waiting for docker daemon to start up:" | |
until /usr/bin/docker ps 2>&1| grep STATUS>/dev/null; do sleep 1; done; >/dev/null | |
/usr/bin/docker ps -a | grep sandbox | |
if [ $? -eq 0 ]; then | |
/usr/bin/docker start sandbox | |
else | |
docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \ | |
-p 6080:6080 \ | |
-p 18081:18081 \ |
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 os | |
import numpy as np | |
import torch | |
import torchvision | |
import torch.nn as nn | |
from torchvision import datasets, models, transforms | |
import matplotlib.pyplot as plt | |
import torch.optim as optim | |
import argparse | |
import logging |
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
from keras.layers import Input, Dense | |
from keras.models import Model, load_model | |
from keras.datasets import mnist | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import os | |
class MnistAutoencoder: | |
# load data |
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
for f in *; do [ -d ./"$f" ] && find ./"$f" -maxdepth 1 -exec echo \; | wc -l && echo $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
import numpy as np | |
data = [[3, 1.5, 1], | |
[2, 1, 0], | |
[4, 1.5, 1], | |
[3, 1, 0], | |
[3.5, .5, 1], | |
[2, .5, 0], | |
[5.5, 1, 1], | |
[1, 1, 0]] |
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
soup.find('div', {'class': 'date'}).find('i').extract() | |
<div class="date"> | |
10 November, 2017 <i class="dibaca"> | |
dibaca normal 1 menit | |
</i> | |
</div> | |
dengan perintah di atas, hasilnya bakalan seperti ini |
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
text: "saya akan mengerjakan bandung, malang, bandung dan kota kembang yang indah, saya akan mengerjakan tugas dengan rajin, bandung, baik." | |
hasil: | |
[ | |
'saya akan mengerjakan bandung, malang, bandung dan kota kembang yang indah', | |
'saya akan mengerjakan tugas dengan rajin, bandung, baik.' | |
] |
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
BM25 | |
biar mereka saja, kan santai jadinya = Langit biru : 0.0 | |
biar mereka saja, kan santai jadinya = Anjing itu lebih pintar dari rubah : 0.0 | |
biar mereka saja, kan santai jadinya = Anjing, rubah dan kucing adalah teman baik : 0.0 | |
biar mereka saja, kan santai jadinya = biar anak-anak aja, biar bisa lebih santai : 1.0 | |
biar mereka saja, kan santai jadinya = “ Sekali lagi, momentum ini harus dimanfaatkan betul. Jangan sampai momentum ini lewat dan kita tidak mendapat apa-apa, ” : 0.0 | |
biar mereka saja, kan santai jadinya = “ Saya harapkan menteri tidak membuat kebijakan baru yang belum dikonsultasikan kepada publik, pada masyarakat, belum melalui kajian dan perhitungan perhitungan mendalam, sehingga justru bisa membikin hal-hal yang tidak diinginkan masyarakat dan membuat masyarakat kecewa, ” : 0.0 | |
biar mereka saja, kan santai jadinya = “ Saya sering dapat bisikan dari Ibu Jokowi, Pak, Ibu Mufidah itu sangat sederhana. Sangat sabar. Saya nggak tahu dengan Pak JK, ” : 0.0 | |
biar mereka saja, kan santai jadinya = “ Pu |
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
wget -c --tries=0 --read-timeout=20 url_nya |
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
re.sub(r'[^\x00-\x7f]|\&\w+;|\&\#\w+;', r'', string).strip() |