Skip to content

Instantly share code, notes, and snippets.

@a4amaan
a4amaan / docker-compose.yml
Created January 20, 2024 09:58 — forked from cmackenzie1/docker-compose.yml
Docker Compose for DynamoDB Local and Admin UI
version: '3.7'
services:
dynamodb-local:
image: amazon/dynamodb-local:latest
container_name: dynamodb-local
ports:
- "8000:8000"
dynamodb-admin:
image: aaronshaf/dynamodb-admin
@a4amaan
a4amaan / .gitlab-ci
Created April 8, 2023 20:27 — forked from Slauta/.gitlab-ci
electron-updater from private repo gitlab.com
variables:
VERSION_ID: '1.0.$CI_PIPELINE_ID'
stages:
- build
build:
image: slauta93/electron-builder-win
stage: build
artifacts:
@a4amaan
a4amaan / crypto.js
Created March 28, 2023 20:48 — forked from PradyumnaKrishna/crypto.js
RSA Encryption/Decryption in Python and Nodejs
const crypto = require('crypto');
var { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem'
}
});
@a4amaan
a4amaan / cloudflareworker-verifyjwt.js
Created October 6, 2021 16:31 — forked from bcnzer/cloudflareworker-verifyjwt.js
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@a4amaan
a4amaan / store.js
Last active September 13, 2021 13:58
Vuex Store Example
import Vue from "vue";
import Vuex from "vuex";
import _ from "lodash";
Vue.use(Vuex);
let API_URL = "http://localhost:8000/api";
export default new Vuex.Store({
state: {
status: false,
@a4amaan
a4amaan / crypto.py
Created July 20, 2021 14:56 — forked from tcitry/crypto.py
python cryptography AES-256-ECB
import base64
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.backends import default_backend
from django.utils.encoding import force_bytes, force_text
SECRET_KEY = "hellomotherfucker"
value = force_bytes("12345678901234567890")
backend = default_backend()
@a4amaan
a4amaan / index.js
Created May 3, 2021 11:13 — forked from acfatah/index.js
Quasar Vue Router Middleware Pipeline Example
// router/index.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import middlewarePipeline from './middleware-pipeline'
Vue.use(VueRouter)
@a4amaan
a4amaan / gist:92fceae5b72c21916e1c1d8099307047
Created April 12, 2021 20:36 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@a4amaan
a4amaan / mongodb-objectid.js
Created April 12, 2021 20:29 — forked from chrisveness/mongodb-objectid.js
Generates a MongoDB-style ObjectId in Node.js
/**
* Generates a MongoDB-style ObjectId in Node.js. Uses nanosecond timestamp in place of counter;
* should be impossible for same process to generate multiple objectId in same nanosecond? (clock
* drift can result in an *extremely* remote possibility of id conflicts).
*
* @returns {string} Id in same format as MongoDB ObjectId.
*/
function objectId() {
const os = require('os');
const crypto = require('crypto');