Skip to content

Instantly share code, notes, and snippets.

View nulpunkt's full-sized avatar

Jesper Skovgård Nielsen nulpunkt

View GitHub Profile
@nulpunkt
nulpunkt / empty-search-notes.md
Created April 3, 2024 11:48
Empty searches notes
wc -l empty_searches_7d.log 
  12914 empty_searches_7d.log
cat empty_searches_7d.log | jq -c '[ .q, .lang ]' | sort | uniq | wc -l
7670

so

7670/12914
.5939
@nulpunkt
nulpunkt / throw-into-skyfish.py
Last active October 10, 2019 09:32
Upload a file to Skyfish via the API
import requests
import json
import sys
import time
import os
if len(sys.argv) < 3:
raise Exception("Usage: python throw-into-skyfish.py <folder_id> <file_path>")
auth = {'Authorization': 'CBX-SIMPLE-TOKEN Token=TOKENGOESHERE'}
@nulpunkt
nulpunkt / gitgood.md
Last active June 1, 2018 09:33
Notes for friday school

Git good!

Adding files

git add -p will let you add changes to parts of a file

git commit -a will commit all changes to all files known to git

Regret!

I want to change what I did in the previous commit. Make everything look like you want it to look. Add the changes and commit with: git commit --amend

@nulpunkt
nulpunkt / oldest_todo.bash
Created October 27, 2014 10:48
Find the oldest TODO in the codebase
git grep -n -w "FIXME\|TODO\|XXX" | awk '{ print $1 }' | while read fileline; do
filename=`echo $fileline | cut -d: -f1`
lineno=`echo $fileline | cut -d: -f2`
time=`git blame -p -t $filename -L$lineno,$lineno | grep author-time | cut -d' ' -f2`
msg=`git blame $filename -L$lineno,$lineno`
echo "$time $fileline $msg"
done | sort | cut -d' ' -f1-
@nulpunkt
nulpunkt / testing-intro.md
Last active December 21, 2015 04:19
This is supposed to be a mild intro testing.

Kinds of test

There are as many kinds of tests there are names for them. However, there are three useful classes of tests that I will cover

Unit tests

Unit tests tests the smallest possible part of the system. This could be a function which determines if a license needs renewal. This implies that unit tests do not touch the database.

Integration tests

Integration tests tests the boundaries between classes. Integration tests may rely on the database, multiple classes and so on. They strive to make sure that a specific feature is working. This could "Does User::getById work?".

System test