Skip to content

Instantly share code, notes, and snippets.

View ndrhzn's full-sized avatar

Andrii Hazin ndrhzn

View GitHub Profile
@ndrhzn
ndrhzn / index.html
Last active January 5, 2019 22:31
P5 - Jittering Lines
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js"></script>
<title>Jittering Lines</title>
</head>
<style media="screen">
body {
@ndrhzn
ndrhzn / index.html
Last active January 5, 2019 23:10
P5 - Rotating Squares
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js"></script>
<title>Rotating Squares</title>
</head>
<style media="screen">
body {
@ndrhzn
ndrhzn / index.html
Last active January 5, 2019 22:50
P5 - Jittering Rectangles
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js"></script>
<title>Jittering Rectangles</title>
</head>
<style media="screen">
body {
@ndrhzn
ndrhzn / index.html
Last active January 5, 2019 23:33
Vega-Lite - Ticks - Responsive Data Visualization
<!DOCTYPE html>
<html>
<head>
<title>Температура в Києві, 1812-2016 рік</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet">
<style media="screen">
library(magrittr)
library(dplyr)
library(ggplot2)
population <- read.csv("https://raw.githubusercontent.com/andriy-gazin/datasets/master/ageSexDistribution.csv")
population %<>%
tidyr::gather(sex, number, -year, - ageGroup) %>%
mutate(ageGroup = gsub("100 і старше", "≥100", ageGroup),
ageGroup = factor(ageGroup,
@ndrhzn
ndrhzn / getcolor.py
Last active December 10, 2017 22:16 — forked from zollinger/getcolor.py
Simple way to get dominant colors from an image in Python
import Image, ImageDraw
def get_colors(infile, outfile, numcolors=10, swatchsize=20, resize=150):
image = Image.open(infile)
image = image.resize((resize, resize))
result = image.convert('P', palette=Image.ADAPTIVE, colors=numcolors)
result.putalpha(0)
colors = result.getcolors(resize*resize)