Skip to content

Instantly share code, notes, and snippets.

View aluxian's full-sized avatar

Alexandru Rosianu aluxian

View GitHub Profile
@adtac
adtac / Dockerfile
Last active July 24, 2024 14:11
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@greird
greird / slack-files-downloader.sh
Last active July 23, 2024 18:22
Download all files from a Slack workspace export folder.
#!/bin/bash
#
# This script will browse a Slack export folder and download all files in a new /export folder
#
# HOW TO:
# 1. As a Workspace admin, download an export of your Slack history (https://www.slack.com/services/export)
# 2. Make sure you have jq installed (https://stedolan.github.io/jq/)
# 3. Place this file at the root of your Slack export folder, next to channels.json
# 4. Run `bash slack-files-downloader.sh` in your terminal
#
// ==UserScript==
// @name Disable YouTube playlists
// @description Remove playlist part from watched videos
// @namespace https://gist.github.com/Maxr1998/f07175ad05ed5c783da9b98bceee61a6
// @downloadURL https://gist.github.com/Maxr1998/f07175ad05ed5c783da9b98bceee61a6/raw/2b47f9d7949f95b1b6e50f3be79d49ac48f95af7/disable_youtube_playlists.user.js
// @updateURL https://gist.github.com/Maxr1998/f07175ad05ed5c783da9b98bceee61a6/raw/2b47f9d7949f95b1b6e50f3be79d49ac48f95af7/disable_youtube_playlists.user.js
// @author Maxr1998
// @version 0.1.1
// @match *://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?domain=youtube.com
@patro85
patro85 / JWT Decode.sh
Last active June 19, 2022 15:46
A BBEdit Text Filter script to take textual input and produce decode of JWT tokens.
#!/bin/bash
#
# JWT Decode
# https://gist.github.com/patro85/2a76d16181730989b9b9af6a7ca6cd1e
#
# A BBEdit Text Filter script to take textual input and produce decode of JWT tokens.
# Note: Signature section is ignored. Meant to be used in conjunction with a separate JSON
# formatter.
#
# Installation instructions: Place this file in BBEdit's "Text Filters" folder inside of
@Wallacy
Wallacy / apollo.ts
Last active January 29, 2023 16:33
Apollo Server + Cloudflare Workers
import { ApolloServerBase, Config, gql } from 'apollo-server-core'
export class ApolloServer extends ApolloServerBase {
protected override serverlessFramework(): boolean {
return true
}
public async createHandler() {
await this.ensureStarted()
return async (request: Request) => {
@evanreichard
evanreichard / pwa-everything.user.js
Created January 1, 2022 21:28
pwa-everything.user.js
// ==UserScript==
// @name PWA Everything
// @author Evan Reichard
// @version 0.0.1
// @match *://*/*
// @grant none
// @run-at document-idle
// @noframes
// ==/UserScript==
@StarLard
StarLard / DetentSheet.swift
Last active January 7, 2023 07:22
A simple implementation of an UISheetPresentationController wrapper using SwiftUI
//
// DetentSheet.swift
// StarLardKit
//
// Created by Caleb Friden on 9/28/21.
//
import SwiftUI
// MARK: - Public
@jonatas
jonatas / hypertable_trigger.sql
Last active January 24, 2022 08:36
Timescale continuous aggregates over top of continuous aggregates - Caggs over top of caggs (POC)
DROP TABLE ticks CASCADE;
DROP TABLE ohlc_1s CASCADE;
CREATE TABLE ticks ( time TIMESTAMP NOT NULL, symbol varchar, price decimal, volume int);
CREATE TABLE ohlc_1s ( time TIMESTAMP NOT NULL, symbol varchar, o decimal, h decimal, l decimal, c decimal, v int);
SELECT create_hypertable('ticks', 'time');
SELECT create_hypertable('ohlc_1s', 'time');
CREATE OR REPLACE FUNCTION feed_ohlc_1s() RETURNS trigger AS
$BODY$
DECLARE
@Maffsie
Maffsie / install-alpine.sh
Last active August 10, 2022 23:27
Hetzner-centric Alpine Linux provisioning script
#!/bin/sh
IPADDR=`ifconfig eth0 | grep 'inet ' | awk '{print $2}'`
IP6ADDR=`ifconfig eth0 | grep 'inet6 ' | awk '{print $2}' | grep -v '^f'`
DFROUTE=`route -n | grep '^0.0.0.0' | awk '{print $2}'`
DF6ROUTE="fe80::1"
IPSUB="27"
IP6SUB="64"
WORKDIR=`mktemp -d`
cd $WORKDIR
@sindresorhus
sindresorhus / esm-package.md
Last active July 25, 2024 04:47
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.