Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile
@pyk
pyk / python-on-windows-10.md
Last active January 30, 2020 08:54
Setup Python development in Windows 10

Python Setup

Download and install Python 3.8.

Open the folder using VSCode.

Open the VSCode terminal using CTRL + J.

Then create new virtualenv using the following command:

@pyk
pyk / README.md
Last active September 18, 2019 17:53
Install Oracle java 8 on debian jessie

Run

wget https://gist.githubusercontent.com/pyk/19a619b0763d6de06786/raw/b09ce3a6626484adb5339597dfd391d0db9fe3cb/install-oracle-java-8-on-debian-jessie.sh
sh install-oracle-java-8-on-debian-jessie.sh

See the following blog post

total_miles total_paid
390.0 36.66
403.0 37.05
396.5 34.71
383.5 32.5
321.1 32.63
391.3 34.45
386.1 36.79
371.8 37.44
404.3 38.09
@pyk
pyk / config.py
Last active February 18, 2019 12:35
config.py
from os import environ as env
import multiprocessing
PORT = int(env.get("PORT", 8080))
DEBUG_MODE = int(env.get("DEBUG_MODE", 1))
# Gunicorn config
bind = ":" + str(PORT)
workers = multiprocessing.cpu_count() * 2 + 1
threads = 2 * multiprocessing.cpu_count()
Click==7.0
Flask==1.0.2
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
Werkzeug==0.14.1
@pyk
pyk / app.py
Last active February 18, 2019 10:18
from flask import Flask
import config
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
import json
output = open("kumparan-news-dataset-19062018-16112018.txt", "w")
for line in open("typo-detector-dataset.json"):
data = json.loads(line)
output.write(data["title"].strip() + "\n")
if "content" in data:
output.write(data["content"].strip() + "\n")
P(di|jokowi) = 0.07768
P(dan|jokowi) = 0.07121
P(yang|jokowi) = 0.03387
P(-|jokowi) = 0.02851
P(juga|jokowi) = 0.02798
P(akan|jokowi) = 0.02315
P(untuk|jokowi) = 0.01838
P(saat|jokowi) = 0.01520
P(dalam|jokowi) = 0.01455
P(itu|jokowi) = 0.01343
@pyk
pyk / index.md
Created September 15, 2018 17:50 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@pyk
pyk / app.js
Last active July 31, 2018 16:06
app.js
// Models is sequelize instance
app.use('/smartphones', smartphonesRouter(models));