This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns universe.core | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true])) | |
(def app-state (atom {:text "Hello Boids" | |
:birds (map vector | |
(repeatedly 20 #(rand-int 1000)) | |
(repeatedly 20 #(rand-int 1000)))})) | |
(defn make-bird [[x y]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def screen-width 100) | |
(def screen-height 30) | |
(defn scaled-x [x] | |
(- (* (/ x screen-width) 3.5) 2.5)) | |
(defn scaled-y [y] | |
(- (* (/ y screen-height) 2) 1)) | |
(defn mandel [x y iteration x0 y0 max-iteration] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Time-stamp: <2012-05-06 Sun 16:07 msmtprc> | |
# This file must have no more than user read/write permissions. | |
account work | |
host mail.work.net | |
user someone.something@work.net | |
password password | |
auto_from off | |
from someone.something@work.net | |
maildomain work.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Code for a music video where sheet music is | |
scrolled transparently on my hands playing the | |
piano. See that effect here: | |
https://www.youtube.com/watch?v=V2XCJNZjm4w | |
""" | |
from moviepy.editor import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A basic .muttrc for use with Gmail and GPG | |
set imap_user="###@gmail.com" | |
set imap_pass="###" | |
set smtp_url="smtp://###@gmail.com@smtp.gmail.com:587/" | |
set smtp_pass="###" | |
set from="###@gmail.com" | |
set realname="###" | |
set editor="vi" | |
set folder="imaps://imap.gmail.com:993" | |
set spoolfile="+INBOX" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# addnote.py by JP Mens (September 2015), inspired by Martin Schmitt | |
# Usage: addnote subject "body (may be empty") [image ...] | |
# Adds a Notes.app (OSX and iOS) compatible message to the "Notes" | |
# IMAP folder. The IMAP store is configured from a file called | |
# `creds': | |
# | |
# [imap] | |
# hostname = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tmup () | |
{ | |
echo -n "Updating to latest tmux environment..."; | |
export IFS=","; | |
for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ","); | |
do | |
if [[ $line == -* ]]; then | |
unset $(echo $line | cut -c2-); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
以下の論文で提案された改良x-means法の実装 | |
クラスター数を自動決定するk-meansアルゴリズムの拡張について | |
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf | |
""" | |
import numpy as np | |
from scipy import stats | |
from sklearn.cluster import KMeans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'csv' | |
require 'Date' | |
require 'optparse' | |
SCRIPT_VERSION = [1, 0, 0] | |
class Transaction | |
attr_accessor :transaction_id, :type, :date, :num, :rows | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Upsert function for pandas to_sql with postgres | |
# https://stackoverflow.com/questions/1109061/insert-on-duplicate-update-in-postgresql/8702291#8702291 | |
# https://www.postgresql.org/docs/devel/sql-insert.html#SQL-ON-CONFLICT | |
import pandas as pd | |
import sqlalchemy | |
import uuid | |
import os | |
def upsert_df(df: pd.DataFrame, table_name: str, engine: sqlalchemy.engine.Engine): |
OlderNewer