Skip to content

Instantly share code, notes, and snippets.

(defn- debounce-future
"Returns future that invokes f once wait-until derefs to a timestamp in the past."
[f wait wait-until]
(future
(loop [wait wait]
(Thread/sleep wait)
(let [new-wait (- @wait-until (System/currentTimeMillis))]
(if (pos? new-wait)
(recur new-wait)
(f))))))
@hdemers
hdemers / pydata-science.sh
Last active June 1, 2020 07:17
Installation instructions for doing data science in a Python environment on Ubuntu. We'll install base packages like numpy, scipy, scikit-learn and pandas. We also install the IPython Notebook interactive environment. This is a best practice recommendation for doing research-type work. We make use of virtualenvwrapper, but don't show how to inst…
mkvirtualenv datascience
sudo apt-get install python-scipy libblas-dev liblapack-dev gfortran
sudo apt-get install libffi-dev # for cryptography from scrapy
sudo apt-get install libxslt-dev # for libxml from scrapy
export BLAS=/usr/lib/libblas.so
export LAPACK=/usr/lib/liblapack.so
pip install numpy
pip install scipy
pip install scikit-learn
pip install pandas
@teropa
teropa / resources.md
Last active December 4, 2020 05:42
Clojure Resources

Tutorials

@onlytiancai
onlytiancai / import_zone.py
Created June 21, 2013 07:56
从zonefile文件把域名记录导入到DNSPod
# -*- coding: utf-8 -*-
'''
功能:
从zonefile文件导入域名到Dnspod
requirements:
dnspython==1.10.0
requests==1.0.4
'''
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@clojens
clojens / re.clj
Created December 12, 2013 17:58
A few clojure java regex samples
(def ptrn
{
:a {:pattern #"a(?!b)"
:purpose "Only allow a if it is not preceded by a 'b' (negative lookahead)"
:samples ["acdefg" ; ok
"abcdef" ; nil
]}
:b {:pattern #"(?i)(<title.*?>)(.+?)(</title>)"
@hwdsl2
hwdsl2 / .MOVED.md
Last active May 19, 2024 06:28
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@alfredodeza
alfredodeza / real.py
Last active April 26, 2022 10:58
Real time subprocess stdout/stderr
import logging
import threading
import os
import subprocess
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):

This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.


Highly recommended things!

This is my five-star list. These are my favorite things in all the world.

A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★