This file contains hidden or 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
#!/bin/sh | |
# A Mac utility to transcribe audio files using OpenAI's API (Whisper) | |
# | |
# Usage: | |
# | |
# $OPENAI_API_KEY='your-key-here' sh ./transcribe.sh [/path/to/the/dir/with/the/audio/files] | |
# | |
# If the path to the files is not specified, the utility will work in the current directory |
This file contains hidden or 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
// POST request body to /stub BFF endpoint | |
interface StubSetup { | |
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | |
path: string | |
headers: { [headerName: string]: string } | |
responseCode: number | |
responseBody: any | |
} |
This file contains hidden or 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
// Not ready yet, don't try this at home | |
import React, { useState } from 'react'; | |
type Model = number; | |
interface AgGridMethods { | |
getModel: () => Model; | |
setModel: (model: Model) => void; | |
} |
This file contains hidden or 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 {Builder, By} = require('selenium-webdriver'); | |
const {BROWSERSTACK_USERNAME, BROWSERSTACK_KEY} = process.env; | |
if (!BROWSERSTACK_USERNAME || !BROWSERSTACK_KEY) | |
throw Error('Specify BROWSERSTACK_USERNAME and BROWSERSTACK_KEY env vars!'); | |
const chrome = { | |
browserName: 'Chrome', | |
browser_version: '70.0', | |
os: 'Windows', |
This file contains hidden or 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 nullNode = null; | |
const node1 = { | |
left: nullNode, | |
right: nullNode, | |
value: 1 | |
}; | |
const node3 = { | |
left: nullNode, |
This file contains hidden or 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
// wait in milliseconds | |
function throttle(fn, wait) { | |
// unix timestamp | |
let lastTimeExecuted; | |
return function (args) { | |
const currentTime = new Date(); | |
// this condition is satisfied only the very first time | |
if (!lastTimeExecuted) { |
This file contains hidden or 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
# Usage: export_volume volume_name | |
# export_volume volume_name > file.tar | |
# | |
# prints to STDOUT a volume in .tar format | |
export_volume() { | |
# Quit if volume name is not specified | |
vol=${1:?} | |
# If there is no such container, a new container will be created, we don't need that | |
docker volume inspect $vol > /dev/null || (echo "Container specified for export doesn't exist" && return 1) |
This file contains hidden or 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
# A way to quickly start bedrock-flavored (see roots.io) WordPress site in Docker | |
# Here are the steps: | |
# - Add `127.0.0.1 your-site.com` to /etc/hosts files with `sudo nano /etc/hosts` | |
# - Save this file as docker-compose.yml in the root of your project (along with composer.json) | |
# - Put your database to db.sql in the root of the project, if any | |
# - Execute `docker-compose up -d` | |
# - Wait for approximately 10-100 seconds | |
# - Navigate to `localhost` | |
version: "3" |
This file contains hidden or 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 App | |
def self.call env | |
new(env).call | |
end | |
def initialize env | |
@request = Rack::Request.new env | |
@response = Rack::Response.new | |
end |
This file contains hidden or 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
# PubSub with a microservice: send a message to a fleet of workers, | |
# let one of workers pick the task and send the result message directly to the requester. | |
# the manager | |
# pub.rb | |
require 'redis' | |
trap(:INT) { puts 'Bye!'; exit } | |
r = Redis.new |
NewerOlder