This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#library import | |
import duckdb | |
import configparser | |
from duckdb.experimental.spark.sql import SparkSession as session | |
from duckdb.experimental.spark.sql.functions import col, when, lit | |
#read configs from secrets file | |
config = configparser.ConfigParser() | |
config.read('duck_db_demo/secrets.ini') | |
user = config['POSTGRES']['USER'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC | |
from typing import Callable, TypeVar, Generic | |
T = TypeVar('T') | |
class Maybe(Generic[T], ABC): | |
def __init__(self, value: T | None): | |
self.value = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git update-index --skip-worktree <filepath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetchAll() { | |
return firebase.firestore().collection('objects').get().then(snapshot => ( | |
{ | |
[Symbol.iterator]: function iterator() { | |
const { docs } = snapshot; | |
return { | |
next() { | |
return { | |
done: docs.length === 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const str = `Mussum Ipsum, cacilds vidis litro abertis. Si u mundo tá muito paradis? | |
Toma um mé que o mundo vai girarzis! Viva Forevis aptent taciti sociosqu ad litora torquent. | |
Aenean aliquam molestie leo, vitae iaculis nisl. | |
Leite de capivaris, leite de mula manquis sem cabeça. | |
Posuere libero varius. Nullam a nisl ut ante blandit hendrerit. Aenean sit amet nisi. | |
Delegadis gente finis, bibendum egestas augue arcu ut est. Admodum accumsan disputationi eu sit. | |
Vide electram sadipscing et per. Sapien in monti palavris qui num significa nadis i pareci latim. | |
Interagi no mé, cursus quis, vehicula ac nisi. Manduma pindureta quium dia nois paga. | |
Mais vale um bebadis conhecidis, que um alcoolatra anonimis. Si num tem leite então bota uma pinga aí cumpadi!`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will open up a prompt for text to send to a console session on digital ocean | |
// Useful for long passwords | |
(function () { | |
window.sendString = function (str) { | |
f(str.split("")); | |
function f(t) { | |
var character = t.shift(); | |
var i=[]; | |
var code = character.charCodeAt(); | |
var needs_shift = character.match(/[A-Z!@#$%^&*()_+{}:\"<>?~|]/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "<project-name>", | |
"version": "0.0.1", | |
"productName": "<Product Name>", | |
"main": "<entrypoint>", | |
"repository": { | |
"type": "git", | |
"url": "<repo-url>" | |
}, | |
"author": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hasDebutIn90s = character => character.debut >= 1990; | |
const getName = character => character.name; | |
console.log(characters.filter(hasDebutIn90s).map(getName)); | |
// [ | |
// "Captain Falcon", | |
// "Fox", | |
// "Kirby" | |
// ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const result = ( | |
characters | |
.filter(character => character.debut >= 1990) | |
.map(character => character.name) | |
); | |
// [ | |
// "Captain Falcon", | |
// "Fox", | |
// "Kirby" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hasDebutAfter1980 = character => character.debut > 1980; | |
const withFind = characters.find(hasDebutAfter1980); | |
const withReduce = characters.reduce((accumulator, character) => { | |
if(hasDebutAfter1980(character) && !accumulator) { | |
return character; | |
} | |
return accumulator; |
NewerOlder