Skip to content

Instantly share code, notes, and snippets.

View mindcrime's full-sized avatar
🌎
Plotting world domination...

Phillip Rhodes mindcrime

🌎
Plotting world domination...
View GitHub Profile
@mindcrime
mindcrime / gist:2656468e137e6a73d55cc63b6f039673
Created October 16, 2024 15:40 — forked from jackrusher/gist:5139396
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)
@mindcrime
mindcrime / ch02_ex239.py
Last active June 3, 2023 23:24
Exploring Exercise 2.39 in "Math for Programmers" by P. Orland
'''
Created on Jun 3, 2023
@author: prhodes
'''
from ch02.vector_drawing import *
from math import sqrt, pi, cos, sin, tan, asin, acos, atan, atan2, isclose
@mindcrime
mindcrime / gist:aeac89aa32d94366068a292fd2b527fd
Created May 1, 2022 21:16
Build ejabberd from source on Fedora 35
#!/bin/bash
dnf -y install automake autoconf
dnf -y install erlang-rebar erlang-rebar3 erlang-relx
dnf -y install erlang-amf erlang-bear erlang-cache_tab erlang-compiler erlang-debugger erlang-doc erlang-eimp
dnf -y install zlib zlib-devel
dnf -y install openssl openssl-devel
dnf -y install libyaml libyaml-devel
dnf -y install gcc-c++ gcc
dnf -y install expat expat-devel
@mindcrime
mindcrime / chapter1.pl
Created July 5, 2018 23:11
Prolog samples from Chapter 1 of Clocksin & Mellish
diff(X,Y) :- X \== Y.
male(albert).
male(edward).
female(alice).
female(victoria).
parents(edward, victoria, albert ).
@mindcrime
mindcrime / httpClientSample.java
Last active June 26, 2018 16:09
Sample use of HTTP GET with Commons HttpClient
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet("http://localhost/");
CloseableHttpResponse response = httpclient.execute(httpget);
try
{
<...>
}
finally
{
response.close();
@mindcrime
mindcrime / pom.xml
Created August 19, 2017 00:38 — forked from martensjostrand/pom.xml
Empty pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>artifactid</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>projectName</name>
com.fasterxml.jackson.core.JsonFactory
com.fasterxml.jackson.core.ObjectCodec
com.fasterxml.jackson.databind.Module
com.sun.jersey.spi.container.ContainerProvider
com.sun.jersey.spi.container.ContainerRequestFilter
com.sun.jersey.spi.container.ResourceMethodCustomInvokerDispatchProvider
com.sun.jersey.spi.container.ResourceMethodDispatchProvider
com.sun.jersey.spi.container.WebApplicationProvider
com.sun.jersey.spi.HeaderDelegateProvider
com.sun.jersey.spi.inject.InjectableProvider
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fogbeam.dl4j</groupId>
<artifactId>dl4j-spark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>dl4j-spark</name>
<description>dl4j-spark</description>
<properties>
@mindcrime
mindcrime / gist:1f16788a8330b746fbf187d332f932bf
Created February 26, 2017 20:28
manual invocation of the preprocessor
JavaRDD<DataSet> unscaledData = rdd.map(new DataVecDataSetFunction(1,10, false, null, null ));
JavaRDD<DataSet> trainingData = unscaledData.map( new Function<DataSet,DataSet>() {
DataNormalization scaler = new ImagePreProcessingScaler(0,1);
@Override
public DataSet call(DataSet v1) throws Exception {
DataSet newDS = new DataSet( v1.getFeatures(), v1.getLabels());
scaler.preProcess(newDS);
@mindcrime
mindcrime / gist:b440cc83fde2a4cf7735fd37b31a23d8
Created February 26, 2017 19:23
call() method in DataSetDavaVecFunction
public DataSet call(List<Writable> currList) throws Exception {
//allow people to specify label index as -1 and infer the last possible label
int labelIndex = this.labelIndex;
if (numPossibleLabels >= 1 && labelIndex < 0) {
labelIndex = currList.size() - 1;
}
INDArray label = null;
INDArray featureVector = null;