Skip to content

Instantly share code, notes, and snippets.

@fela
fela / gpt_fda.txt
Created March 30, 2023 20:06
GPT Analisis of file
# Assistant:
{"comment": "Printing first few lines of the file", "python": "with open('food-enforcement.json') as f:\n for i in range(3):\n print(f.readline().strip())"}
## Extracting comment:
Printing first few lines of the file
## Extracting python code:
with open('food-enforcement.json') as f:
for i in range(3):
print(f.readline().strip())
## Do you want to execute this code? (y/n)
y
@fela
fela / zane_zaphyr.md
Last active February 17, 2023 19:39
A story by Bing Chat
@fela
fela / snape.py
Last active January 5, 2022 22:46
from collections import defaultdict
def all_pairs():
for n1 in range(2, 65):
for n2 in range(n1+1, 65+1):
yield n1, n2
def prod(pair):
#!/usr/bin/env python3
import sys
from random import random
def single_trial():
"""
Generate a random 2 dimensional point between (0, 0) and (1, 1)
and returns weather the distance to the origin is less than 1
#!/usr/bin/env python3
RADIX = 10
# radix sort that works for non negative integers
def radix_sort_nonneg(lst):
last_iteration = False
radix_power = 1
while not last_iteration:
@fela
fela / hatN.R
Last active August 29, 2015 14:08
#########################################
# helpers #
#########################################
# helper to calculate s
s.func <- function(X) {
# norms ^ 4
norms4 <- apply(X, 2, function(Xi) (Xi%*%Xi)^2)
n <- ncol(X)
@fela
fela / keybase.md
Created September 23, 2014 09:10
Keybase proof

Keybase proof

I hereby claim:

  • I am fela on github.
  • I am fela (https://keybase.io/fela) on keybase.
  • I have a public key whose fingerprint is 0875 81C7 564F 1E05 5EE3 8D05 7B0D 4361 506C 15B0

To claim this, I am signing this object:

@fela
fela / selfX.rb
Created July 4, 2013 15:26
The output of this script is equal to the script itself.
#!/usr/bin/env ruby
x=<<'X'
#!/usr/bin/env ruby
x=<<'X'
x+="X\n"
x=x.split("\n")
x=x[0..1]+x[0..7]+x[2..-2]
puts x.join("\n")
X
x+="X\n"
#!/usr/bin/env ruby
$VERBOSE = true
$:.unshift File.dirname($0)
require 'Qt4'
module Shoes
def self.app &blk
require 'thread'
Shoes.app do
@s = stack do
para "this is a para in the stack.."
end
Thread.new do
sleep 0.1
@s.remove