Skip to content

Instantly share code, notes, and snippets.

@lukeplausin
lukeplausin / transfer_ssm_file.sh
Last active May 6, 2025 05:58
Transfer a file to EC2 SSM instance without using S3 (SSM only)
# This script will explain how to transfer a file to EC2 using SSM ONLY!
# You will need to have permission to run SSM commands on the target machine and have sudo access as well
# Infos
INSTANCE_ID=i-1234567890
FILE_NAME=the_file.tar.gz
# Step 1: Run command on machine to install netcat and dump from port to filename
# < Start session
@fjahn
fjahn / deletionEndpoint.mjs
Last active March 6, 2025 13:44
Facebook Data Deletion Callback
import crypto from 'crypto'
import parseSignedRequest from './parseSignedRequest.mjs'
import { instance as fileStorage } from '../ConfirmingFileStorage.mjs'
import { getLogger } from '../logger.mjs'
import { toAbsoluteUrl } from '../util.mjs'
const logger = getLogger('deletionEndpoint')
export function registerHandles (app) {
@waska14
waska14 / FileHelper.php
Last active September 26, 2024 21:11
Laravel: create UploadedFile object from base64 string (autoremove temp file)
<?php
namespace App\Helpers\File;
use Illuminate\Http\File;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Arr;
class FileHelper
{
@kyle-mccarthy
kyle-mccarthy / cache-config.service.ts
Created February 20, 2020 20:48
nest.js cache config for redis
import {
CacheModuleOptions,
CacheOptionsFactory,
Injectable,
} from '@nestjs/common';
import { LoggerService } from '@src/common/logger.service';
import { ConfigOptions, ConfigService } from '@src/config/config.service';
import * as redisCacheStore from 'cache-manager-redis-store';
@Injectable()
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlxrwmuYSAsTfn+lUu4go
ZSXBD9ackM9OJuwUVQHmbZo6GW4Fu/auUdN5zI7Y1dEDfgt7m7QXWbHuMD01HLnD
4eRtY+RNwCWdjNfEaY/esUPY3OVMrNDI15Ns13xspWS3q+13kdGv9jHI28P87RvM
pjz/JCpQ5IM44oSyRnYtVJO+320SB8E2Bw92pmrenbp67KRUzTEVfGU4+obP5RZ0
9OxvCr1io4KJvEOjDJuuoClF66AT72WymtoMdwzUmhINjR0XSqK6H0MdWsjw7ysy
d/JhmqX5CAaT9Pgi0J8lU/pcl215oANqjy7Ob+VMhug9eGyxAWVfu/1u6QJKePlE
+wIDAQAB
-----END PUBLIC KEY-----
@Mark-McCracken
Mark-McCracken / damerau-levenshtein.sql
Last active August 31, 2023 08:48
BigQuery string fuzzy matching damerau-levenshtein distance
CREATE OR REPLACE FUNCTION `functions.fuzzy_match_damerau_levenshtein_distance`(s1 STRING, s2 STRING) RETURNS INT64 LANGUAGE js AS """
/*
* Based off https://github.com/fabvalaaah/damerau-levenshtein-js
* input: Two strings to compare the edit distance of. You probably want to lowercase/trim these before passing to this function
* returns: Integer of the edit distance.
*/
const initMatrix = (s1, s2) => {
if (undefined == s1 || undefined == s2) {
return null;
}
@WebReflection
WebReflection / why-i-use-web-components.md
Last active October 18, 2024 10:55
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@gasparrobi
gasparrobi / headlessChrome.md
Last active December 12, 2024 02:43
headless chrome from terminal in osX

1. set an alias for chrome:

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

2. To remote control your chrome headless:

chrome --headless --disable-gpu --remote-debugging-port=9222

@heathdutton
heathdutton / upgrade-php7.sh
Last active January 12, 2024 07:47
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5
#
# Must be ran as sudo:
# sudo bash upgrade-php7.sh
#
# Can be added to ./.ebextensions/20_php.config like so:
# container_commands:
@flockonus
flockonus / customEmojiCount.js
Last active October 23, 2024 04:12
Count your emojis from Slack usage!
'use strict';
/**
npm i bluebird slack-node
CREATE YOUR TOKEN: https://api.slack.com/docs/oauth-test-tokens?team_id=T024G49EC&action=reissue&sudo=1
npm package: https://www.npmjs.com/package/slack-node
user.list: https://api.slack.com/methods/users.list