Skip to content

Instantly share code, notes, and snippets.

View apriady's full-sized avatar

Achmad Apriady apriady

View GitHub Profile
sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 443 -j REDIRECT --to-ports 8443
@apriady
apriady / Mongoose Aggregate
Created September 4, 2017 06:15
Mongoose aggregate to get total amount
var mongoose = require('mongoose');
app.service('donation').Model
.aggregate([
{
$match: {
eventid: new mongoose.Types.ObjectId(req.body.event)
}
},
{
$group: {
@apriady
apriady / stsgen.sh
Created July 12, 2023 10:04
Bash script to generate AWS_SESSION_TOKEN and set to target profile (Include integration with 1password)
#!/bin/bash
AWS_BASE_PROFILE=base-profile
AWS_TARGET_PROFILE=target-profile
ARN_OF_MFA=arn:aws:iam::1234567890:mfa/mfa-device
DURATION=129600
AWS_CLI=`which aws`