Skip to content

Instantly share code, notes, and snippets.

View kot-behemoth's full-sized avatar

Greg Goltsov kot-behemoth

View GitHub Profile
@kot-behemoth
kot-behemoth / altair_app.py
Created March 24, 2020 17:18 — forked from germayneng/altair_app.py
Altair plot in Plotly Dash
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import sqlalchemy
import altair as alt
import io
from vega_datasets import data
@kot-behemoth
kot-behemoth / altair-zoomed-map.md
Last active April 9, 2019 10:25
Blog: "Zooming in" on a map in Altair

"Zooming in" on a map in Altair

Altair [doesn't allow making maps (aka mark_geoshape) interactive][altair-issue], since geo markers do not yet support interaction in Vega-Lite ([vega/vega-lite#3306][vega-lite-issue]).

I stumbled upon this problem when I needed to only display information in only one US state, but the [official example][map-example] shows the full map of the US. Furthermore, it's not possible to set a fixed zoom, so that only one state is visible when the map is shown.

@kot-behemoth
kot-behemoth / hammock.md
Last active April 5, 2019 11:48
Hammock-driven Development

Hammock-Driven Development Summary

Solve problem vs create features

  1. state the problem
  2. understand: facts, context, constraints
    • what don't you know?
    • related problems out there?
  3. be discerning
  • problems & tradeoffs in your solutions: technical, logical - solve
@kot-behemoth
kot-behemoth / aabill.md
Last active December 21, 2018 11:55
How to help against AABill

How to help again AABil

Social media is great for raising awareness but insufficient to create change in legislation. We encourage you to reach out directly if this issue matters to you.

  • Australians: Contact your MP, on behalf of yourself, or your company (if you have the authority to do so). The EFA has a step-by-step guide on how to find out who your representative is, and the best way to get a result.
  • Educate your friends, your colleagues, your family and ask them to also talk to their MPs.
  • Australians and others: Submit a letter to the PJCIS by the end of March 2019. The inquiry is there to record concerns from anyone affected by the bill. Don’t hold off submitting because you think someone else will do it, or because you’re not sure what to say. Every entry helps our lawmakers see the breadth and depth of the impact of the new law.
  • If you’re not an Australian, be aware that the appetite for this type of law is not limited to Australia. Stay informed and engaged with this topic in your part of
import itertools
from ipaddress import ip_address
all_ips_tuples = itertools.product(range(256), repeat=4)
# these are generators, meaning they don't store all values in memory
ip_strings = ('.'.join(map(str, ip_tuple))
for ip_tuple in all_ips_tuples)
ip_objects = (ip_address(ip_string)
for ip_string in ip_strings)
### Keybase proof
I hereby claim:
* I am kot-behemoth on github.
* I am gregoltsov (https://keybase.io/gregoltsov) on keybase.
* I have a public key ASAc_OJ-I8wpcOfOOTlG9C2S-3rKcwupAMyR4s4A_MW7sQo
To claim this, I am signing this object:
# elementary arrays I'll use to define directions
pos = [i for i in range(4)]
neg = [-i for i in pos]
zer = [0]*4
# First, compute the direction vectors. Given a coordinate and a direction vector,
# we can generate four coordinates in a desired direction. We'll care about 8 directions.
# Even though left/right, and up/down are the same, let's no worry about that for now.
# 1 2 3
# \ | /
@kot-behemoth
kot-behemoth / latex.template
Created December 10, 2012 21:14 — forked from bosmacs/latex.template
Simple Pandoc latex.template with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.