Skip to content

Instantly share code, notes, and snippets.

@iynere
iynere / bipartite-2-color-recursive.js
Created April 19, 2017 08:51
recursive two-color / bipartite graph solution
/* TWO-COLOR PROBLEM,
i.e., whether or not a given undirected, connected graph is bipartite:
https://en.wikipedia.org/wiki/Bipartite_graph */
/* complexity [of non-recursive Fullstack Academy solution] ? O(n*n) i believe, O(n*n+n) technically */
/* can we do better ? definitely */
/* given a graph */
let zero = {num: 0},
@iynere
iynere / ccm_fl.js
Last active April 25, 2017 00:55
slight edits to http://moonconnection.com/moon_module.phtml js to force https, so chrome doesn't complain (ex: https://isar0se.github.io/moon-module-ex)
/* if you're trying to embed this on your blog or website:
0. generate yr embed code as usual from https://moonconnection.com/moon_module.phtml
- replace the js file path with this one
1. use https://rawgit.com to spoof headers
- full url for this file is https://cdn.rawgit.com/isar0se/0c9c6580ee5097389a16aaa00e8c7673/raw/35dea55bce3955524d29d2024d7b6a06b4e32ce0/ccm_fl.js
- if you try to past the raw file url in directly, the content type will be 'plain text' not 'javascript' or w/e
2. chrome disables flash autoplay by default & there's no way to un-disable it
- the moon embed is annoying if there's a play button
- but if you bump the embed width* to something like 700 at least (not sure the exact cutoff), chrome assumes it's content & not advertising & allows autoplay
- autoplay is enabled via the '&autoPlay=true' param in the FlashVars string
@iynere
iynere / phoneWords.js
Last active May 11, 2017 15:39
string permutation problem, tree implementation solution
// given the traditional correspondences between numbers & letters on a telephone, as follows:
const phone = {
'2': 'ABC',
'3': 'DEF',
'4': 'GHI',
'5': 'JKL',
'6': 'MNO',
'7': 'PQRS',
'8': 'TUV',
@iynere
iynere / README.md
Last active May 11, 2017 09:00
cryptoSquare

Crypto Square

Slides

Difficulty: Medium

Cohort Date
Jan-15 2014-04-06

FROM ubuntu:14.04
USER root
# set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
# use unicode
RUN locale-gen C.UTF-8 || true
ENV LANG=C.UTF-8
@iynere
iynere / Dockerfile
Last active January 28, 2021 10:12
redis 2.8.4 Dockerfile: https://hub.docker.com/r/iynere/redis
FROM redis:2.8.6
# downgrade to Redis 2.8.4
WORKDIR /usr/local/bin
# http://grainier.net/how-to-uninstall-redis-server-from-ubuntu
RUN rm -r redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server
WORKDIR /
FROM circleci/ruby:2.4.1-node-browsers
USER root
# pulling in commands from 'install os packages'
RUN sudo apt-get update
RUN sudo apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x postgresql-client
# install elasticsearch
RUN wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.2.tar.gz
FROM circleci/ruby:2.3.4-node
# pulling in commands from 'install os packages'
RUN sudo apt-get update
RUN sudo apt-get -qq install -y xvfb graphicsmagick
FROM circleci/ruby:2.3-node
# downgrade to Node v6.8.0
RUN sudo npm cache clean -f
RUN sudo npm install -g n
RUN sudo n 6.8.0
FROM mdillon/postgis:9.4
ENV POSTGRES_USER=root \
POSTGRES_DB=circle_test
# This is performance optimization tweak to make DB faster
RUN if [ -e /usr/local/share/postgresql/postgresql.conf.sample ]; then \
postgresfile=/usr/local/share/postgresql/postgresql.conf.sample; \
else \
postgresfile=/usr/share/postgresql/postgresql.conf.sample; \