Skip to content

Instantly share code, notes, and snippets.

@forstie
forstie / db2_to_json.sql
Last active May 2, 2024 07:42
The request... Is it possible to extract data from IBM i into JSON format with a Db2 service?
--
-- Subject: The request... return SQL services detail using JSON.
-- Author: Scott Forstie
-- Date : April, 2023
-- Features Used : This Gist uses qsys2.syscolumns2, listagg(), rtrim(), dynamic SQL, SQL PL, PIPE
--
-- Note:
-- When someone asks you to return Db2 for i data "as JSON", they probably want you
-- to publish a JSON document, which contains good key names and of course, the data.
--
@joakin
joakin / git-find-me-the-fucking-deleted-file.sh
Last active May 2, 2024 07:41
finding a deleted file in a git repository
# If you don't remember the exact path/name, search the log for deleted files
git log --diff-filter=D --summary | grep delete
# Find the file you want to get from the ouput, and use the path
# Find the commits that involved that path
git log --all -- some/path/to/deleted.file
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
@bonniss
bonniss / better-sqlite3-cheatsheet.md
Last active May 2, 2024 07:35
better-sqlite3 cheatsheet

Refs:

// Init new db
// If the database file does not exist, it is created
// This happens synchronously, which means you can start executing queries right away
const Database = require('better-sqlite3');
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active May 2, 2024 07:32
Vanilla JavaScript Quick Reference / Cheatsheet
@gregfromstl
gregfromstl / registerFidAndSigner.ts
Created May 2, 2024 01:00
Register a Farcaster FID and Signer
import { createThirdwebClient, simulateTransaction } from "thirdweb";
import { sendAndConfirmTransaction } from "thirdweb/transaction";
import { privateKeyToAccount } from "thirdweb/wallets";
import {
createEd25519Keypair,
registerFidAndSigner,
} from "thirdweb/extensions/farcaster";
import { optimism } from "thirdweb/chains";
const ANVIL_PRIVATE_KEY_A =
@homaily
homaily / gist:8672499
Last active May 2, 2024 07:30
Regex to validate saudi mobile numbers

السلام عليكم ، هذا كود ريجيكس بسيط للتحقق من صحة أرقام الجوالات السعودية ، يقوم الريجيكس بالتحقق من مفتاح الدولة ، مفتاح شركة الإتصالات لضمان صحة النص المدخل .

Hello, this is a simple regex to validate saudi mobile numbers, the code will validate country code, telecome company code and make sure the tested sting is correct .

/^(009665|9665|\+9665|05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$/

Regex Breakdown - شرح الكود

@kennyeliason
kennyeliason / makewpsuck.sh
Last active May 2, 2024 07:30
Make WP Suck Less or More
#!/bin/bash
# Make sites into bedrock or normal WordPress
# Version 2.0
# Copyright (c) Kenny Eliason
set -a
source .env
set +a
@matt2005
matt2005 / lambda_function.py
Last active May 2, 2024 07:29 — forked from awarecan/lambda_function.py
Alexa Smart Home Skill Adapter for Home Assistant
"""
Copyright 2019 Jason Hu <awaregit at gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@fnky
fnky / ANSI.md
Last active May 2, 2024 07:28
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27