Skip to content

Instantly share code, notes, and snippets.

View AlexAti's full-sized avatar

Alex Ati AlexAti

View GitHub Profile
@AlexAti
AlexAti / mcp3008.py
Last active May 21, 2017 20:19 — forked from ladyada/adafruit_mcp3008.py
C.H.I.P. Computer Analog Input with MCP3008
#!/usr/bin/env python3
# Adapted for CHIP Computer and Python3 from Limor "Ladyada" Fried for Adafruit Industries, (c) 2015
# This code is released into the public domain
import time
import os
import CHIP_IO.GPIO as GPIO
DEBUG = 1
@AlexAti
AlexAti / silent-pomodoro.sh
Last active September 27, 2016 16:24
A simple pomodoro timer that dims the screen, for macos.
## A pomodoro timer that dims the screen for resting periods ##
# Variables and constants
working=25 # Minutes until next break
resting=5 # Minutes of rest
RED='\033[0;31m'
NOC='\033[0m'
# First check if the brightness command is installed or else abort script
@AlexAti
AlexAti / caskupdater.sh
Created September 23, 2016 16:15
A simple script to update and upgrade brew and all casks, copied from somewhere...
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cask update;)
(set -x; brew upgrade;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
@AlexAti
AlexAti / coverage.clj
Created October 6, 2015 20:22
Question: How many elements of a population do I get with n samples of size s?
(defn coverage-in-n-samples [samples size population]
"Question: How many elements of a population do I get with n samples of size s?"
(let [pop (range 0 population)]
(->> (range 0 samples)
(map (fn [dumb] (take size (shuffle pop))))
(doall)
(flatten)
(distinct)
(count)
(* (/ 1.0 population)))))