Skip to content

Instantly share code, notes, and snippets.

@dfellis
dfellis / cnn.py
Created July 26, 2023 01:49
Marsha output for cnn.mrsh
import requests
from bs4 import BeautifulSoup
def cnn(section: str) -> list:
if section == 'home':
url = 'https://www.cnn.com/'
else:
url = f'https://www.cnn.com/{section}'
@dfellis
dfellis / example04.js
Created September 15, 2021 01:15
Remote Execution Fourth Example
const degsToRads = (deg) => Math.PI / 180 * deg;
const haversine = (origin, dest) => Math.acos(
Math.sin(degsToRads(origin.lat)) * Math.sin(degsToRads(dest.lat)) +
Math.cos(degsToRads(origin.lat)) * Math.cos(degsToRads(dest.lat)) * Math.cos(degsToRads(dest.lng - origin.lng))
);
let bbox = 0.1;
for (; (await query(`
select count(*) from notablePlaces
where notablePlaces.lat < $0 + $2
and notablePlaces.lat > $0 - $2
@dfellis
dfellis / example03.js
Created September 15, 2021 01:15
Remote Execution Third Example
const degsToRads = (deg) => Math.PI / 180 * deg;
const haversine = (origin, dest) => Math.acos(
Math.sin(degsToRads(origin.lat)) * Math.sin(degsToRads(dest.lat)) +
Math.cos(degsToRads(origin.lat)) * Math.cos(degsToRads(dest.lat)) * Math.cos(degsToRads(dest.lng - origin.lng))
);
const notablePlaces = await query(`select * from notablePlaces`);
const relevantPlaces = notablePlaces
.map((p) => ({
name: p.name,
img: p.img,
@dfellis
dfellis / example02.js
Created September 15, 2021 01:14
Remote Execution Second Example
const userTripsInOrder = await query(`
select * from trips
where trips.userId == $0
order by trips.startTime desc;
`, [userId]);
const outputUserTripsInOrder = userTripsInOrder.map((t) => ({
type: t.type,
price: t.price,
serviceProvider, t.serviceProvider,
origin: {
@dfellis
dfellis / example01.js
Created September 15, 2021 01:14
Remote Execution First Example
const trips = await query(`select * from trips;`);
const userTripsInOrder = trips
.filter((t) => t.userId === userId)
.map((t) => ({
type: t.type,
price: t.price,
serviceProvider: t.serviceProvider,
origin: {
lat: t.originLat,
lng: t.originLng,
@dfellis
dfellis / example01.js
Created September 15, 2021 01:10
Remote Execution Blog Snippets
const trips = await query(`select * from trips;`);
const userTripsInOrder = trips
.filter((t) => t.userId === userId)
.map((t) => ({
type: t.type,
price: t.price,
serviceProvider: t.serviceProvider,
origin: {
lat: t.originLat,
lng: t.originLng,
@dfellis
dfellis / chicken_marsala.md
Created July 2, 2021 04:32
Chicken Marsala Recipe

Chicken Marsala

Ingredients

  • 4 chicken breasts, cubed
  • 1/2 cup of flour
  • Salt to taste
  • Pepper to taste
  • Oregano to taste (but even or greater than the salt)
  • 8 Tablespoons of butter (half of a block of Kerrygold butter)
@dfellis
dfellis / taco_recipe.md
Created February 4, 2021 01:57
Taco Recipe!

Taco Recipe (with homemade ground beef sub-recipe)

The exact fillings can be adjusted to your tastes. Personally if I'm going with crunch corn taco shells, I go with beef, hot sauce, tomato, lettuce, and cheese, while if I'm going with soft taco tortillas I go with beef, hot sauce, tomato, black beans, rice, and cheese. Others add things like sour cream, corn kernels, guacamole, salsa, diced onions, and so on. Choose the ingredients you like best on that front, but stay a bit closer on the seasoned beef recipe ;)

Ingredients

  • Taco "shells" (either crunchy corn or soft flour tortillas)
  • Seasoned ground beef (see below)
  • Louisiana Hot Sauce (ideally the one that says "The Original Louisiana Hot Sauce" on the bottle as that is one of the very few on the market with no preservatives added, it's also a bit stronger in flavor and heat than Crystal/Texas Pete/etc and less vinegary than Tabasco)
  • Aged white cheddar (shredded by hand; pre-shredded cheese is literally mixed with wood pulp, don't buy it)
@dfellis
dfellis / Makefile
Created June 14, 2015 22:44
Example KafkaFilter Repo
JAVA=java
JC=javac
JAR=jar
SPRAYNOZZLEPATH=./kafka-spraynozzle
HTTPCOMPONENTSPATH="$(SPRAYNOZZLEPATH)/httpcomponents-client-4.3.6"
CLASSPATH="$(SPRAYNOZZLEPATH)/kafkaSpraynozzle.jar:$(HTTPCOMPONENTSPATH)/lib/commons-codec-1.6.jar:$(HTTPCOMPONENTSPATH)/lib/commons-logging-1.1.3.jar:$(HTTPCOMPONENTSPATH)/lib/fluent-hc-4.3.6.jar:$(HTTPCOMPONENTSPATH)/lib/httpclient-4.3.6.jar:$(HTTPCOMPONENTSPATH)/lib/httpclient-cache-4.3.6.jar:$(HTTPCOMPONENTSPATH)/lib/httpcore-4.3.3.jar:$(HTTPCOMPONENTSPATH)/lib/httpmime-4.3.6.jar"
.PHONY: download build clean build-spraynozzle
download: kafka-spraynozzle
@dfellis
dfellis / borked.sh
Created March 25, 2014 14:44
NPM Borked Again
damocles@moya:~/uber/double-double-wrapper(master)$ npm publish
npm http PUT https://registry.npmjs.org/double-double-wrapper
npm http 503 https://registry.npmjs.org/double-double-wrapper
npm ERR! registry error parsing json
npm http PUT https://registry.npmjs.org/double-double-wrapper
npm http 503 https://registry.npmjs.org/double-double-wrapper
npm ERR! registry error parsing json
npm http PUT https://registry.npmjs.org/double-double-wrapper
npm http 503 https://registry.npmjs.org/double-double-wrapper
npm ERR! registry error parsing json