Skip to content

Instantly share code, notes, and snippets.

@aman-tiwari
aman-tiwari / wfc-elabel-connected.lp
Last active May 29, 2020 17:35
asp map generation with connectivity constraints
#const n = 5.
#const m = 5.
% define?
cell(1..m, 1..n).
% tiles, format:
% pdef((tile name, rotation in 90deg increments), bottom edge, right edge, top edge, left edge)
pdef((line_v, 0), empty, path, empty, path).
pdef((line_v, 1), path, empty, path, empty).
@aman-tiwari
aman-tiwari / wfc-elabel.lp
Created November 17, 2017 07:16
wfc with edge labels in clingo
#const n = 3.
% define?
cell(1..n, 1..n).
% kinds of edges
edge_kind(path).
edge_kind(empty).
% tiles, format:
@aman-tiwari
aman-tiwari / wfc.lp
Last active November 16, 2017 00:45
wfc in clingo?
% Default
#const n = 5.
% define?
cell(1..n, 1..n).
pattern(a).
pattern(b).
dx(0, 1).
// 'stroke' changes all the
// edges:
scale 0.3
background 0
10 times
i = 0
@aman-tiwari
aman-tiwari / .block
Last active October 30, 2017 06:50
Pano 2 persp
license: mit
@aman-tiwari
aman-tiwari / supported_device.patch
Created September 17, 2017 20:47
Diff of change needed to allow WebARonARCore run on all devices. Use with `patch -p1 < supported_device.patch`
index df7f8cb..46cdd7b 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -429,7 +429,7 @@ public class AwShellActivity extends Activity implements OnRequestPermissionsRes
super.onCreate(savedInstanceState);
// If the device is not supported, show an alert and quit.
- if (!SupportedDevices.isSupported(this))
+ if (false)
{
@aman-tiwari
aman-tiwari / WORKSHOP.md
Last active January 10, 2021 07:55
Document containing install instructions and cool links for the Making Maps with ML workshop!

Messing with Maps and ML quickstart

This document: https://goo.gl/AqGoE8

Installation instructions

By far the most annoying part of getting started with messing with ML is installing researcher-made code and turning it into something fun to play with.

Before doing any of these, please install Miniconda. If you don't have it installed already, here's how:

For OSX, this is:

@aman-tiwari
aman-tiwari / particle_system.py
Last active May 25, 2017 06:05
A little particle system for your terminal : )
from itertools import chain
from math import sqrt
from random import random
import drawille
def wrap(x, low, high):
if x > high:
return low
@aman-tiwari
aman-tiwari / url_reader.py
Created November 1, 2016 20:45
read remote image files in tensorflow // url file reader
import tensorflow as tf
from skimage import io
import time
N_THREADS = 64
BATCH_SIZE = 32
N_IMGS = 1000
random_img = 'url to load'
@aman-tiwari
aman-tiwari / https-sticky.md
Created August 1, 2016 21:37 — forked from bprashanth/https-sticky.md
https sticky sessions

Create a backend service that simply serves the pod name, and a frontend haproxy instance that balances based on client cookies.

# This is the backend service
apiVersion: v1
kind: Service
metadata:
  name: hostname
  annotations:
    # Enable sticky-ness on "SERVERID"
    serviceloadbalancer/lb.cookie-sticky-session: "true"