Skip to content

Instantly share code, notes, and snippets.

View DeaconDesperado's full-sized avatar

Mark Grey DeaconDesperado

  • Spotify
  • NY, New York
View GitHub Profile
@tyrcho
tyrcho / pca.sc
Last active November 25, 2020 21:37
Principal Component Analysis with Breeze (Scala)
// For an unkown reason, this works when copy/paste in ammonite but not with `amm pca.sc`
import $ivy.`org.scalanlp::breeze-natives:0.13.2`
import $ivy.`org.scalanlp::breeze-viz:0.13.2`
import $ivy.`org.scalanlp::breeze:0.13.2`
import breeze.linalg._
import breeze.linalg.svd._
import breeze.plot._
import scala.util.Random._
@DeaconDesperado
DeaconDesperado / cherrypy_daemon.py
Last active August 12, 2016 23:57
Run cherrypy WSGI server as a daemon
from cherrypy.process.plugins import Daemonizer,PIDFile
import cherrypy
import argparse
parser = argparse.ArgumentParser(description="My server daemon")
parser.add_argument('-d','--daemon',help='Run the server as a daemon using the traditional double fork',action='store_true')
parser.add_argument('-a','--bind-address',help='Network interface to bind to',default='127.0.0.1')
parser.add_argument('-p','--port',help='Port to bind to',default=8080,type=int)
parser.add_argument('--pidfile',help='process id file',type=str)
args = parser.parse_args()
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
@insin
insin / app.jsx
Last active July 13, 2021 07:39
React Form Handling - handleFormInputChange (Live version: http://bl.ocks.org/insin/raw/082c0d88f6290a0ea4c7/)
var INPUT_TYPES = 'color|date|datetime|datetime-local|file|month|number|password|range|search|tel|text|time|url|week'.split('|')
var App = React.createClass({
getInitialState: function() {
return {}
},
onChange: handleFormInputChange,
render: function() {
@vchernetskyi993
vchernetskyi993 / Cargo.toml
Last active May 18, 2025 20:52
Rust - Single testcontainer for multiple test functions
[package]
name = "testcontainers-sample"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
async_once = "0.2.6"
aws-sdk-s3 = "0.28.0"
ctor = "0.2.4"
lazy_static = "1.4.0"