Skip to content

Instantly share code, notes, and snippets.

View joshcarp's full-sized avatar

Joshua Carpeggiani joshcarp

View GitHub Profile
func TestStringRange(t *testing.T) {
str := "¥"
println("len string is ", len(str))
println("for _, s := range str {")
for _, s := range str {
println(s) // prints 165
}
println("for i := 0; i < len(str); i++ {")
for i := 0; i < len(str); i++ {
println(str[i]) // prints 194 then 165
confusion_matrix: [[65, 12], [6, 17]]
accuracy: 0.82
f_score: 0.8783783783783784
('>50K', [('>50K', -19.55627365283215), ('<=50K', -20.71689698193305)])
Attribute vectors of instances [0, 1, 2]: [[68 '?' '1st-4th' 2 'Divorced' '?' 'Not-in-family' 'White' 'Female' 20
'United-States']
[39 'State-gov' 'Bachelors' 13 'Never-married' 'Adm-clerical'
'Not-in-family' 'White' 'Male' 40 'United-States']
[50 'Self-emp-not-inc' 'Bachelors' 13 'Married-civ-spouse'
'Exec-managerial' 'Husband' 'White' 'Male' 13 'United-States']]
{
"n": 5,
"board": [
["b", 1, 0],
["b", 1, 1],
["b", 1, 3],
["b", 3, 2]
],
"start": [4, 2],
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="${HOME}/.pyenv"
fi
colorize() {
@joshcarp
joshcarp / cp-differences.md
Created October 13, 2021 01:39
Differences between cp on macos and linux

macos: cp -r dir/ will copy everything INSIDE output linux will copy the whole folder (output)

macos

mkdir dir1
touch dir1/blah
mkdir dir2
cp -r dir1/ dir2
ls dir2/
put (?s) at the start of the capturing group:
https://stackoverflow.com/questions/20173472/does-go-regexps-any-charcter-match-newline
(?s)\n\[(?P<command>\w*)\]:#\s\((?P<args>(\s*\S*?,?)*)\).*<!--->
@joshcarp
joshcarp / gist:973faa8bb70703780d6b6488e2b7c4e2
Created August 11, 2021 12:09
github graphql to get closing issues linked to a pull request
{
viewer {
repository(name: "glowing-umbrella") {
pullRequest(number: 8) {
closingIssuesReferences(first:1) {
nodes {
number
}
}
}
version: '3.6'
services:
spanner:
image: roryq/spanner-emulator:0.8.2
healthcheck:
test: |
curl --fail http://localhost:9020/v1/projects/test-project/instances/test-instance/databases/database1
timeout: 45s
interval: 1s
retries: 10
FROM python:2.7.18-stretch
RUN pip2.7 install bsddb3
@joshcarp
joshcarp / docker-compose.yaml
Created April 29, 2021 00:44
test docker-compose envi vars
version: '3.6'
services:
foobar:
image: debian
environment:
- FOO="blah"
entrypoint: bash -c "echo $$FOO"