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
.DEFAULT_GOAL := help | |
.PHONY: help | |
help: | |
@echo "Welcome to $(NAME)!" | |
@echo "Use 'make <target>' where <target> is one of:" | |
@echo "" | |
@echo " all run build -> stop -> run" | |
@echo " build build docker image based on shell ENV_VAR" | |
@echo " stop stop docker container" | |
@echo " run run docker container" |
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: Generate CSV | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 23 * * *" # https://crontab.guru/#30_23_*_*_* | |
env: | |
PGDATABASE: ${{ secrets.PGDATABASE }} | |
PGHOST: ${{ secrets.PGHOST }} | |
PGPASSWORD: ${{ secrets.PGPASSWORD }} | |
PGPORT: ${{ secrets.PGPORT }} |
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
image: renovate/renovate:32.6.12 | |
variables: | |
LOG_LEVEL: debug | |
renovate:on-schedule: | |
tags: | |
- your-gitlab-runner-tag-if-any | |
only: | |
- schedules |
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
// ... | |
app.collector.OnXML(restaurantXPath, func(e *colly.XMLElement) { | |
url := e.Request.AbsoluteURL(e.ChildAttr(restaurantDetailUrlXPath, "href")) | |
location := e.ChildText(restaurantLocationXPath) | |
longitude := e.ChildAttr(restaurantXPath, "data-lng") | |
latitude := e.ChildAttr(restaurantXPath, "data-lat") | |
e.Request.Ctx.Put("location", location) |
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
// /server/src/datasources/paste.js | |
const { ApolloError } = require('apollo-server-cloudflare') | |
const moment = require('moment') | |
/* | |
Create a new paste in `PASTE_DB`. | |
Fetch a new `uuid` key from `KEY_DB`. | |
UUID is then removed from `KEY_DB` to avoid duplicates. |
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
// handlers/createShortUrl.js | |
import { generateUniqueUrlKey } from '../utils/urlKey' | |
export const createShortUrl = async (request, event) => { | |
try { | |
const urlKey = await generateUniqueUrlKey() | |
const { host } = new URL(request.url) | |
const shortUrl = `https://${host}/${urlKey}` |
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 TODOIST_API_ENDPOINT = 'https://api.todoist.com/rest/v1' | |
// Passing in the `question` object from fetchDailyCodingChallenge function | |
const createTodoistTask = async question => { | |
const questionInfo = question.data.activeDailyCodingChallengeQuestion | |
const questionTitle = questionInfo.question.title | |
const questionDifficulty = questionInfo.question.difficulty | |
const questionLink = `https://leetcode.com${questionInfo.link}` |
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
def add_book(book_id, storage=[]): | |
storage.append(book_id) | |
return storage | |
my_book_list = add_book(1) | |
print(my_book_list) | |
my_other_book_list = add_book(2) | |
print(my_other_book_list) |
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
# List Comprehension | |
# ------------------ | |
cProfile.run('sum([i * i for i in range(100_000_000)])') | |
# 5 function calls in 13.956 seconds | |
# Ordered by: standard name | |
# ncalls tottime percall cumtime percall filename:lineno(function) | |
# 1 8.442 8.442 8.442 8.442 <string>:1(<listcomp>) | |
# 1 0.841 0.841 13.956 13.956 <string>:1(<module>) | |
# 1 0.000 0.000 13.956 13.956 {built-in method builtins.exec} |
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
class Car: | |
def __init__(self, name: str, brand: str, price: int) -> None: | |
self.name = name | |
self.brand = brand | |
self.price = price | |
car1 = Car('Model X', 'Tesla', 120_000) | |
car2 = Car('Model X', 'Tesla', 120_000) |
NewerOlder