Skip to content

Instantly share code, notes, and snippets.

"""
Toy demonstration of chain-of-thought and consensus prompting using OpenAI API.
© Riley Goodside 2022
"""
import os
import re
from statistics import mode
@goodside
goodside / gist:4496435
Created January 9, 2013 20:15
Jumptap curl output
$ curl -v "http://a.jumptap.com/a/ads?l=en&pub=INVALID&site=pa_okcupid2_okcupid_mob_web&spot=pa_okcupid2_okcupid_mob_web_adspot&v=v30"
* About to connect() to a.jumptap.com port 80 (#0)
* Trying 209.94.144.164... connected
* Connected to a.jumptap.com (209.94.144.164) port 80 (#0)
> GET /a/ads?l=en&pub=INVALID&site=pa_okcupid2_okcupid_mob_web&spot=pa_okcupid2_okcupid_mob_web_adspot&v=v30 HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: a.jumptap.com
> Accept: */*
>
@goodside
goodside / gist:3247921
Created August 3, 2012 13:56
Install virtualenv(wrapper) on Debian Squeeze
sudo aptitude install python-pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
$re = qr/
. # single letter is a palindrome
|
(.) # first letter
(??{ $re })?? # apply recursivly (not interpolated yet)
\1 # last letter
/x;
/*
ORIGINAL SOURCE:
I yelled out, "Hello!"
But was it too late?
There was not a word in reply -- none
I will say nothing if you call back, you know
How could I? Did I never truly love you?
Perhaps tomorrow we will know why
@goodside
goodside / gist:722810
Created December 1, 2010 02:10
heredocs
i64478@SysEngineering1:~$ perl <<PERL
> # Note that there is no need for a -e flag.
> print "Helo, world!\n";
> PERL
Helo, world!
i64478@SysEngineering1:~$ perl -e 'print "Hello, world!\n";'
Hello, world!
i64478@SysEngineering1:~$ perl 'print "Hello, world!\n";'
Can't open perl script "print "Hello, world!\n";": No such file or directory
i64478@SysEngineering1:~$
@goodside
goodside / apology.rb
Created November 19, 2010 03:27
Apologetic comment example
1 #! /usr/bin/env ruby
2
3 $:.unshift(File.dirname(__FILE__) + '/../lib') unless
4 $:.include?(File.dirname(__FILE__) + '/../lib')
5
6 require 'parser'
7 require 'test/unit'
8
9
10 class ParserTest < Test::Unit::TestCase
CC=gcc
CFLAGS=-Wall -g SND_FILE=.SUFFIX=
.SUFFIX=.c.o
all : rra2wav wav2rra rraamplitude rraspeed audiocc rravocoder rrahartley rralog_compress rraecho rrawave_gen rrasquare_gen rratriangle_gen rracrush rracat
rra2wav : rra.o rra2wav.o
$(CC) $(CFLAGS) $(SND_FILE) -o rra2wav rra2wav.o rra.o
wav2rra : rra.o wav2rra.o
$(CC) $(CFLAGS) $(SND_FILE) -o wav2rra wav2rra.o rra.o
traditional <- data.frame(
a = 4,
b = list('caterpillars', 'porcupines', 'elephants',
'electric eels that approach silently',
paste(something())
)
)
lispy <-
data.frame(a = 4,
>> if (foo || true) then 'Hi' else 'Bye' end
NameError: undefined local variable or method `foo' for main:Object
from (irb):1
>> foo = nil
=> nil
>> if (foo || true) then 'Hi' else 'Bye' end
=> "Hi"
>> foo = false
=> false
>> if (foo || true) then 'Hi' else 'Bye' end