Skip to content

Instantly share code, notes, and snippets.

(ns sector
(:require [clj-http.client :as http])
(:use [clojure.contrib.json]))
(def couch "http://127.0.0.1:5984/")
(def db (str couch "tagged/"))
(def view (str db "_design/merge/_view/tags"))
;;Just using rqc to record how many rqs are made.
(def rqc (agent 0))
@pingles
pingles / exp_smooth.clj
Created August 21, 2011 09:29
Exponential smooth for incanter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SMOOTHING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn exponential-smooth
"
Smooths a sequence with an exponentially decreasing weight.
Arguments:
x -- a sequence of numbers
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
@sadbox
sadbox / microsoft_sucks.sh
Created March 25, 2014 07:27
microsoft_sucks
#!/bin/bash
# Stolen from http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macoutlook/office-for-mac-mavericks-high-performance-gpu/e1a6aff0-e36e-40ae-ab62-aa7e3e0c6b10
# Enable for Lync
AppName="/Applications/Microsoft Lync.app"
defaults write "$AppName/Contents/Info.plist" "NSSupportsAutomaticGraphicsSwitching" -bool true
if [ $? -eq 0 ]; then
chmod 664 "$AppName/Contents/Info.plist"
# Code sign Lync again
@mommi84
mommi84 / awesome-kge.md
Last active July 4, 2024 09:07
Awesome Knowledge Graph Embedding Approaches

Awesome Knowledge Graph Embedding Approaches

Awesome

This list contains repositories of libraries and approaches for knowledge graph embeddings, which are vector representations of entities and relations in a multi-relational directed labelled graph. Licensed under CC0.

Libraries

#!/usr/bin/python3
# Solution to the challenge at https://gist.github.com/ehmo/7f515ac6461c1c4d3e5a74f12e6eb5ea
# Sample solution: https://twitter.com/marcan42/status/1428933147660492800
#
# Given an input base image, computes two derivative images that have different
# perceptual hashes, yet differ by only one pixel.
#
# Usage: hash_bisector.py <input.png> <output_a.png> <output_b.png>
#
# Licensed under the terms of the STRONGEST PUBLIC LICENSE, Draft 1:
@karpathy
karpathy / stablediffusionwalk.py
Last active July 17, 2024 06:48
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@nateraw
nateraw / stable_diffusion_walk.py
Created August 18, 2022 05:59
Walk between stable diffusion text prompts
"""
Built on top of this gist by @karpathy:
https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355
stable diffusion dreaming over text prompts
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stable_diffusion_walk.py --prompts "['blueberry spaghetti', 'strawberry spaghetti']" --seeds 243,523 --name berry_good_spaghetti
@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯