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 / 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));
@pyk
pyk / SketchSystems.spec
Last active June 26, 2018 17:52
Katalog CMS*
Katalog CMS*
Home Page*
User Click About Link -> About Page
User click login button and success -> Dashboard Page
User click login button and failed -> Unauthorized Page
Dashboard Page
User Click Logout Button -> Home Page
User click create new category button -> New Category Page
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
labels:
service: elasticsearch
spec:
serviceName: es
# NOTE: This is number of nodes that we want to run
# you may update this
npm config set init.author.name "Bayu Aldi Yansyah"
npm config set init.author.email bayualdiyansyah@gmail.com
npm config set init.author.url https://github.com/pyk
npm config set init.license MIT
@pyk
pyk / app-request-rate.py
Created April 1, 2018 21:40
sanic-instrumentation-guide
# app.py
import asyncio
import random
from sanic import Sanic
from sanic import response
import prometheus_client as prometheus
app = Sanic()
@pyk
pyk / app.py
Last active April 1, 2018 21:39
sanic-instrumentation-guide
# app.py
import asyncio
import random
from sanic import Sanic
from sanic import response
app = Sanic()
@app.get("/")
async def index(request):
CANVAS_HEIGHT = 600
CANVAS_WIDTH = 600
FPS = 15
def setup():
"""Setup the canvas"""
# Canvas size
size(CANVAS_HEIGHT, CANVAS_WIDTH, P3D)
# Draw from center
@pyk
pyk / spirals.pde
Created March 14, 2018 09:04 — forked from beesandbombs/spirals.pde
spirals
// 'spirals' by dave
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@pyk
pyk / understanding-word-vectors.ipynb
Created March 2, 2018 14:13 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.