Skip to content

Instantly share code, notes, and snippets.

View electblake's full-sized avatar
🧙

Blake E electblake

🧙
View GitHub Profile
chmod 000 /usr/syno/sbin/synoindexd /usr/syno/sbin/synoindexscand /usr/syno/sbin/synoindexworkderd /usr/syno/sbin/synoindexplugind /usr/syno/sbin/synomediaparserd /usr/syno/bin/synothumb /usr/syno/bin/synomkflv /usr/syno/bin/synomkthumb
@HyperBrain
HyperBrain / package-plugin-lifecycle.md
Last active November 24, 2023 04:56
Serverless - Package/Deploy plugin lifecycle changes

Overview

Currently the Serverless framework only offers lifecycle events that are bound to commands and also are very coarse. Each core plugin only exposes the events that are defined by the framework. This is suboptimal for plugin authors as they want to hook special events within the deployment process.

The PR adds fine grained lifecycles to the AWS deployment process (see below for the current implementation process) and makes the package/deploy plugin implementation non-breaking.

@LindaLawton
LindaLawton / GoogleAuthenticationCurl.sh
Last active December 4, 2024 23:07
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=http://127.0.0.1&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
@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
@air
air / try_realms_api.sh
Last active February 18, 2025 01:52
Let's use the Realms API to download our world backup!
#!/bin/bash
# you need httpie (apt-get install httpie)
# you need to replace <these things> with your details
# run with 'source' to export vars to your shell for experimentation
# 1. authenticate to get an access token
auth_server=https://authserver.mojang.com
user=<your login email>
@kireal
kireal / deduplication_mongod.py
Last active February 12, 2018 18:43
Run to deduplicate mongodb collection
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Deduplication collection mongodb database utility.
#
# Works only with pymongo >= 3.0
# Kireal
#
# 01.10.2016
# Last change: 04.10.2016
@alexmarkley
alexmarkley / s3dl
Last active January 27, 2022 17:36
A minimal authenticated S3 download script using only Bash, Curl, and OpenSSL.
#!/bin/bash
# s3dl
# by Alex Markley; released under CC0 Public Domain
# https://creativecommons.org/publicdomain/zero/1.0/
# Hosted at: https://gist.github.com/alexmarkley/0b45af17fdc805756ac710aeaceb77be
# Example script demonstrating how to fetch a private AWS S3 Object using only basic shell scripting techniques.
#################

AWS Lambda Event Sourcing Architecture

I'd like to have a AWS lambda / event system that allows for a certain kind of flexability, here's what I need.

  • Events come in via HTTP post webhook with headers and body
    1. Store {headers, body} in one main events table where the event is named what the action is e.g. 'orderCreate', this acts as a ledger of events, with the main columns name, data, created_at.
    2. I'd like to build up the state of individual object, in their own table so for orders a table would exist with that name the event of a orderCreated the row is created and subsiquent orderDeleted the row is deleted.
  1. I need a way to tap into this event and trigger some side-effect event, for instance if a orderCreated comes in to the system I also need to fire something when that comes in such as invoiceCreated I need a way to access the stream of all events and subscribe to the orderCreated and fire a invoiceCreated which ideally should repeat this process all over again
'''
Django bulk upsert
Does not attempt to cover all corner cases and related models.
Originally from http://people.iola.dk/olau/python/bulkops.py
Heavily modified by Luka Kladaric [email protected]
'''
from itertools import repeat
from django.db import models, connections, transaction
@nrollr
nrollr / Redis.sh
Created March 29, 2016 11:30
Install Redis via Homebrew
#!/bin/bash
brew install redis # Install Redis using Homebrew
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl
# homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping # Check if the Redis server is running