Skip to content

Instantly share code, notes, and snippets.

View kidpollo's full-sized avatar
💁‍♂️
Potato farming

Paco Viramontes kidpollo

💁‍♂️
Potato farming
  • San Francisco, CA
View GitHub Profile
@kidpollo
kidpollo / local.cljs
Last active March 2, 2023 00:52
nbb + ruuter + axios node proxy
(ns local
{:clj-kondo/config '{:lint-as {promesa.core/let clojure.core/let
applied-science.js-interop/fn clojure.core/fn
applied-science.js-interop/defn clojure.core/defn}}}
(:require [cljs-bean.core :refer [->clj ->js]]
[promesa.core :as p]
["http" :as http]
["url"]
[applied-science.js-interop :as j]
[clojure.string :as string]
@kidpollo
kidpollo / proxy.cljs
Last active February 24, 2023 02:05
NBB + Ruuter + Axios Lambda API proxy
(ns foo
{:clj-kondo/config '{:lint-as {promesa.core/let clojure.core/let
applied-science.js-interop/defn clojure.core/defn}}}
(:require [cljs-bean.core :refer [->clj ->js]]
[ruuter.core :as ruuter]
["axios$default" :as axios]
[clojure.string :as string]
[promesa.core :as p]
[applied-science.js-interop :as j]))
@kidpollo
kidpollo / nginx.conf
Created April 8, 2017 08:18
Simple nginx ssl proxy configiration for local development
# do https://gist.github.com/jed/6147872 and then do this to proxy your app
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
@kidpollo
kidpollo / bootstrap.sh
Last active July 11, 2022 02:44
osx bootstrap
# Install iterm 2 https://www.iterm2.com/
# Install 1password
#install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/paks/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# packages
brew install git git-crypt gpg autojump kube-ps1 stern asdf rlwrap rg
require 'mail'
require 'thread'
require 'parallel'
require 'benchmark'
Mail.defaults do
delivery_method :smtp, options
end
@kidpollo
kidpollo / keybase.md
Created September 23, 2016 06:10
Keybase proof

Keybase proof

I hereby claim:

  • I am kidpollo on github.
  • I am kidpollo (https://keybase.io/kidpollo) on keybase.
  • I have a public key ASD3Rhho5U14SMrLQ9gNilg9-YssXS9hiovYVCkqFw3aFwo

To claim this, I am signing this object:

@kidpollo
kidpollo / monty-hall.clj
Created May 8, 2015 17:03
Monty Hall problem
(defn monty-hall
""
[]
(let [prize-idx (rand-int 3)
doors [false false false]
doors (assoc doors prize-idx true)
random-pick (rand-int 3)
monty-pick (first
(remove nil? (map-indexed
(fn [idx val]
(defn make-change [x coinset]
(loop [x x
change []]
(let [possible-coins (take-while #(when (>= x %) %) coinset)
current-coin (some #(when (zero? (rem x %)) %) possible-coins)]
(cond
(= x (reduce + possible-coins))
(concat possible-coins change)
(= x 0)
change
(ns sudoku-validator.core)
(defn is-valid-solution [grid]
(let [rows (partition-all 9 (map (comp read-string str) grid))
cols (apply map (comp seq vector) rows)
squares (map
flatten
(partition-all
3
(for [base (range 3)
body {
background: #1B1B1B;
color: #BEBEBE;
white-space: pre;
font-family: "Inconsolata", monospace;
}
a {
color: #7BAFC2;
}