Skip to content

Instantly share code, notes, and snippets.

@karljuhlpep
karljuhlpep / dspy_codegen.py
Last active April 24, 2024 04:45
DSPy Module - CodeGen + Debugging
import subprocess
import dspy
### Note this code is not tested, and likely includes errors that need to be refined.
class IterativeCodeRefinement(dspy.Module):
def __init__(self):
super().__init__()
self.generate_pseudocode = dspy.ChainOfThought("task -> pseudocode")
@0mmadawn
0mmadawn / cognito_mfa_sample.tf
Created July 28, 2021 07:24
sample terraform file for creating AWS Cognito (MFA)
variable "aws" {
  default = {
    sms_role_ext_id = "cognito-test-sms-role-external-id"
  }
}
# IAM role for cognito sms
resource "aws_iam_role" "cognito_test_sms" {
    name = "CognitoTest_SMS"
    description           = "role for applicant cognito, send sms"
@jorinvo
jorinvo / challenge.md
Last active April 21, 2023 17:14
This is a little challenge to find out which tools programmers use to get their everyday tasks done quickly.

You got your hands on some data that was leaked from a social network and you want to help the poor people.

Luckily you know a government service to automatically block a list of credit cards.

The service is a little old school though and you have to upload a CSV file in the exact format. The upload fails if the CSV file contains invalid data.

The CSV files should have two columns, Name and Credit Card. Also, it must be named after the following pattern:

YYYYMMDD.csv.

@gka
gka / shp2tsv.py
Created January 15, 2014 23:23
extract a shapefile's attribute table to TSV
import sys, shapefile
if len(sys.argv) < 2:
print "Usage: shp2tsv.py SHAPEFILE\n"
exit(-1)
sf = shapefile.Reader(sys.argv[1])
recs = sf.records()

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@hugolpz
hugolpz / README.md
Last active September 5, 2017 14:17
France_topographic_map.svg

Step 2: Topographic map. final_topo_France.json (topojson) created using makefile.

Attempt to programmatically generate geolocalized France_topographic_map.svg (focus: France, type: topographic map, geolocalised yet light, printable) following existing Wikipedia's guidelines.

Meta: v13.08.22. Makefile: Make4b. Focus: India. Type: topographic_map.

With: topography.

This code is part of the Wikimaps team push for better wikipedia maps. An efforts for both GIS data collection and map generation for the purpose of encyclopedic cartography and free knowledge.

@max-mapper
max-mapper / readme.md
Last active April 28, 2019 03:55
trie implementations on npm

a trie (aka prefix trie) is a way of storing string values such that for an input string (e.g. autocomplete) all matching stored values can be re__trie__ved efficiently

listed alphabetically:

  • burst-trie - burst trie implementation, seems to be written in a Java style, no readme, not sure how fast it is
  • datrie - double array trie - a trie that uses arrays instead of objects for faster + smaller serialization
  • dtrie - trie based on minimal automaton, has stress tests, API is coupled to node though (requires fs)
  • glob-trie - trie with pattern matching expressions like * ? \ etc, has stress tests
  • iptrie - radix/patricia trie implementation specifically for IPv4 and IPv6 addresses
  • [marisa-trie](https://code.google.com/p/mari
@Hypercubed
Hypercubed / README.md
Last active December 12, 2021 02:23
DocPad: rsync Deploy Script

DocPad: rsync Deploy Script

  • Place deploy.sh in {docpad folder}/bin/
  • Create (or edit) a .env file in your docpad folder with the following values:
#!/bin/bash
DEPLOY_SOURCE_DIR="out/"
DEPLOY_DEST_DIR="~/public_html/"
DEPLOY_SERVER=deploy-server-name
@diegovalle
diegovalle / .block
Last active August 2, 2017 16:47
Density map of homicides in Monterrey
license: mit