Skip to content

Instantly share code, notes, and snippets.

@wch
wch / remote_repl.R
Last active August 7, 2019 17:42
Remote R REPL app with httpuv
library(httpuv)
PORT <- 7000
app <- list(
call = function(req) {
page(req)
},
onWSOpen = function(ws) {
ws$onMessage(function(binary, message) {
@jrk
jrk / llvmlisp.cpp
Created November 5, 2009 08:26
Toy LLVM Lisp, originally from http://paste.lisp.org/display/74068
/* A Trivial LLVM LISP
* Copyright (C) 2008-2009 David Robillard <dave@drobilla.net>
*
* Parts from the Kaleidoscope tutorial <http://llvm.org/docs/tutorial/>
* by Chris Lattner and Erick Tryzelaar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@pandeiro
pandeiro / README.md
Last active June 2, 2020 08:02
Example of a simple webapp written as a single file

Instructions

  1. Get Boot
  2. Copy the above file to $HOME/app.boot
  3. $ chmod a+x $HOME/app.boot
  4. $ cd &amp;&amp; ./app.boot
@jcheng5
jcheng5 / README.md
Last active March 10, 2021 16:02
Installing R-devel on Solaris 10 VM

As far as CRAN is concerned, there are two flavors of R on Solaris: one that is built using the Solaris Studio compiler, and one that is built using the GNU/gcc toolchain. The latter is far more up-to-date, but if your package requires it, then your DESCRIPTION file must declare that with the line SystemRequirements: GNU make.

These instructions are for configuring, building, and installing R-devel using the GNU/gcc toolchain (only).

You'll need VMWare Fusion on Mac, or VMWare Workstation (?) on Windows/Linux.

Get Solaris VM

Download the Solaris VM provided by Jeroen Ooms: https://github.com/jeroen/solarisvm

;; depends on [org.imgscalr/imgscalr-lib "4.2"]
(ns XXX.image
(:refer-clojure :exclude [read])
(:require [clojure.java.io :as io])
(:import [org.imgscalr Scalr Scalr$Method Scalr$Mode]
[java.awt Image]
[java.awt.image RenderedImage BufferedImageOp]
[javax.imageio ImageIO ImageWriter ImageWriteParam IIOImage]
@josephholsten
josephholsten / sizeup.lua
Last active June 4, 2022 11:41
SizeUp in Hammerspoon
-- === sizeup ===
--
-- SizeUp emulation for hammerspoon
--
-- To use, you can tweak the key bindings and the margins
local sizeup = { }
--------------
-- Bindings --
@jcheng5
jcheng5 / create_forked_task.R
Last active August 3, 2022 17:11
Concurrent, forked, cancellable tasks in Shiny
library(shiny)
# Also uses parallel, shinyjs, tools
# Create a long-running task, executed in a forked process. (Doesn't work on Windows)
#
# The return value is a promise-like object with three
# methods:
# - completed(): FALSE initially, then TRUE if the task succeeds,
# fails, or is cancelled. Reactive, so when the state changes
# any reactive readers will invalidate.
@ariankordi
ariankordi / unix socket reverse proxy thing.php
Last active December 13, 2022 17:52
Reverse proxy to a UNIX socket with PHP, for when you are running Go web apps on cPanel servers or something like that LOL (complete with header and multipart POST form parsing!) Doesn't work with WebSocket though.
<?php
// This works best on Apache, and if you have enable_post_data_reading off.
// Set "php_flag enable_post_data_reading off" in your htaccess. It'll avoid having to parse multipart forms.
// enter the sock to connect to here
const SOCK_TO_CONNECT_TO = './run.sock';
// Close the session right now, because it might make everything faster, and we don't know how long the response will last for.
session_write_close();
;;; -*- Syntax: ANSI-Common-Lisp; Package: CL-USER -*-
;;; Author: Rainer Joswig, joswig@lisp.de, 2022
;;; This code is written in portable Common Lisp.
; https://adventofcode.com/2022/day/10
;; This solution makes use of multiple dispatch and standard method combinations of CLOS.
(defparameter *input-10*
@taylorbanks
taylorbanks / gist:4196062
Created December 3, 2012 16:24 — forked from samsonjs/gist:4076746
Compiling and running mosh on Dreamhost
PREFIX=$HOME
VERSION=1.2.3-ltb
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=$PREFIX
make
make install