Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

Adam Moore minikomi

🍕
I like pizza
View GitHub Profile
import duckdb
import numpy as np
import pandas as pd
import time
lineitem = pd.read_csv('duckdb_benchmark_data/tpch_lineitem.csv', names=["l_orderkey","l_partkey","l_suppkey","l_linenumber","l_quantity","l_extendedprice","l_discount","l_tax","l_returnflag","l_linestatus","l_shipdate","l_commitdate","l_receiptdate","l_shipinstruct","l_shipmode","l_comment"], parse_dates=['l_shipdate', 'l_commitdate', 'l_receiptdate'])
def udf_disc_price(extended, discount):
return np.multiply(extended, np.subtract(1, discount))
@pseudosavant
pseudosavant / jSugar.js
Last active March 1, 2024 04:48
Utility function that adds in some jQuery-like syntactic sugar
// jQuery-like syntactic sugar. Only queries for one element. Does not loop over multiple like jQuery
function $(query) {
if (typeof query === 'undefined') throw 'No query provided to $';
var el;
if (typeof query.nodeType === 'string') {
el = query;
} else if (typeof query === 'string' && query[0] === '<') {
const container = document.createElement('div');
container.innerHTML = query;
@danielrmeyer
danielrmeyer / configure.sh
Created July 31, 2017 18:07
build emacs in your home dir on minimal server without X and stuff
make
./configure --prefix=/home/<yourhome>/ --with-x-toolkit=no --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no
make install
@aengelberg
aengelberg / core.clj
Created February 3, 2017 16:53
Manifold examples
(ns hello-manifold.core
(:require
[aleph.http :as http]
[byte-streams :as bs]
[cheshire.core :as json]
[clojure.string :as str]
[manifold.deferred :as d]
[manifold.executor :as e]
[manifold.stream :as s]))
@xeoncross
xeoncross / traverse_node.go
Created January 5, 2017 16:29
Simple DOM node traversal in golang using a very useful collector/matcher function
package main
import (
"bytes"
"fmt"
"io"
"strings"
"unicode"
"golang.org/x/net/html"
@sgrove
sgrove / core.cljs
Created September 9, 2015 16:40
ReactMotion + ClojureScript
(ns motionable.core
(:require [om.core :as om]
[om.dom :as dom]
[React :as r :refer [createElement createClass render]]
[ReactMotion :as rm]))
(enable-console-print!)
(def app-state
(atom {:text "Hello world!"}))
@mikeknep
mikeknep / build.boot
Created August 15, 2015 19:46
Basic http server with http-kit and boot
#!/usr/bin/env boot
(set-env! :dependencies '[[http-kit/http-kit "2.1.18"]])
(require '[org.httpkit.server :refer [run-server]])
(defn handler
[request]
(prn request)
{:status 200
:headers {}
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

A Quick and Dirty Lens primer

Why does Lens exist? Well, Haskell records suck, for a number of reasons. I will enumerate them using this sample record.

data User = User { login    :: Text
                 , password :: ByteString
                 , email    :: Text
                 , created  :: UTCTime
 }
@lukechampine
lukechampine / a.c
Created October 19, 2014 01:00
a.c (with a.h expanded)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O printf
#define R return
#define I(a...) if(a)
#define W(a...) while(a)