Skip to content

Instantly share code, notes, and snippets.

@VideoCarp
VideoCarp / lexing.md
Last active May 3, 2024 13:43
Basics of lexing

Lexing for beginners

This is a guide that should teach you how to perform basic lexing in a functional programing language.
Everything was written in Elixir, but you should be able to follow it if you are using any functional programming language.
Or even an imperative programming language like Python, C or Java.\

What is lexing?

The first question you should ask yourself is, what is lexing? It's the same as tokenising, scanning or lexical analysis.
That might not help you if you haven't heard of these either. Put simply, lexing is the process of breaking down a string
into meaningful units, indepdendent of context.
What a lexer will do is make the following happen:

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 13:42
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@pirate
pirate / docker-compose-backup.sh
Last active May 3, 2024 13:42
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@dannanelli
dannanelli / ContactPage-Schema.jsonld
Last active May 3, 2024 13:42
ContactPage Schema Example Template for Local SEO
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ContactPage",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{CONTACT PAGE URL}}"
},
"publisher": {
"@type": "LocalBusiness",
@tyhoff
tyhoff / progress_bar_requests_upload.py
Last active May 3, 2024 13:42
Python requests HTTP PUT with tqdm progress bar
from tqdm import tqdm
from tqdm.utils import CallbackIOWrapper
file_path = os.path.abspath(__file__)
upload_url = https://some-bucket.s3.amazonaws.com
file_size = os.stat(file_path).st_size
with open(file_path, "rb") as f:
with tqdm(total=file_size, unit="B", unit_scale=True, unit_divisor=1024) as t:
wrapped_file = CallbackIOWrapper(t.update, f, "read")
#!/bin/bash
getAWSCredentials()
{
hotctl sso accounts apply -a
hotctl sso accounts apply -n buildstaging=default
hotctl sso accounts apply -n buildstaging=local
hotctl sso accounts apply -n vulcano -r Vulcano-DevOps
hotctl sso accounts apply -n analytics -r Analytics-OnCall
}
@Klerith
Klerith / snippets.json
Last active May 3, 2024 13:38
Dart Snippets
{
// Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@dirk-thomas
dirk-thomas / CMakeLists.txt
Created July 7, 2015 20:05
CMakeLists.txt example with ament
cmake_minimum_required(VERSION 2.8.3)
project(foo)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif()
# find dependencies
@ax3l
ax3l / CUDA_Compilers.md
Last active May 3, 2024 13:36
CUDA Compilers
@maximecharriere
maximecharriere / CGAL_installation_MSVC.md
Last active May 3, 2024 13:36
This tutorial will guide you through the different steps to install CGAL and its third party libraries

Installation of CGAL using MSVC on Windows

by @maximecharriere

This tutorial will guide you through the different steps to install CGAL and its third party libraries.
The purpose of this tutorial is that you don't have to spend weeks like me fighting to make them all work.

Feel free to comment on the gist comment section to make corrections or improvements !