Skip to content

Instantly share code, notes, and snippets.

View TunedMystic's full-sized avatar

Sandeep Jadoonanan TunedMystic

View GitHub Profile
@TunedMystic
TunedMystic / index.js
Created November 13, 2024 20:37 — forked from adrianhorning08/index.js
Scrape Facebook Group
const allContent = []
function createCSV(data, fileName) {
const headers = [
'id',
'email',
'firstName',
'lastName',
'postId',
'postText',
@TunedMystic
TunedMystic / index.js
Created November 13, 2024 20:37 — forked from adrianhorning08/index.js
Decrypt view stats response
// Async function to handle JSON or encrypted response
let decryptResponse = async (response) => {
let result;
// These are Base64 encoded arrays used as the key and IV for AES-GCM decryption
let base64IV =
"Wzk3LCAxMDksIC0xMDAsIC05MCwgMTIyLCAtMTI0LCAxMSwgLTY5LCAtNDIsIDExNSwgLTU4LCAtNjcsIDQzLCAtNzUsIDMxLCA3NF0=";
let base64Key =
"Wy0zLCAtMTEyLCAxNSwgLTEyNCwgLTcxLCAzMywgLTg0LCAxMDksIDU3LCAtMTI3LCAxMDcsIC00NiwgMTIyLCA0OCwgODIsIC0xMjYsIDQ3LCA3NiwgLTEyNywgNjUsIDc1LCAxMTMsIC0xMjEsIDg5LCAtNzEsIDUwLCAtODMsIDg2LCA5MiwgLTQ2LCA0OSwgNTZd";
async function scrollDown() {
const wrapper = document.querySelector("#search-page-list-container");
await new Promise((resolve, reject) => {
var totalHeight = 0;
var distance = 600;
var timer = setInterval(async () => {
var scrollHeightBefore = wrapper.scrollHeight;
wrapper.scrollBy(0, distance);
totalHeight += distance;
@TunedMystic
TunedMystic / render_number.go
Created April 21, 2024 05:50 — forked from gorhill/render_number.go
A Go function to render a number to a string based on the following user-specified criteria: thousands separator, decimal separator, decimal precision. I didn't feel it was worth to publish a library just for this piece of code, hence the snippet. Feel free to reuse as you wish.
/*
Author: https://github.com/gorhill
Source: https://gist.github.com/gorhill/5285193
A Go function to render a number to a string based on
the following user-specified criteria:
* thousands separator
* decimal separator
@TunedMystic
TunedMystic / parse_domain.py
Last active October 4, 2022 00:16
Parse the domain name from a url.
from urllib.parse import urlparse
def parse_domain_name(url: str) -> str:
"""
Parse the domain name from the given url.
"""
return urlparse(url).hostname.split('.')[-2]
@TunedMystic
TunedMystic / links.md
Last active January 10, 2021 05:37
Hacker News: Successful one-person online businesses
@TunedMystic
TunedMystic / add-stylesheet.js
Created June 26, 2020 20:20
Add CSS styles to a webpage.
function addCss(rule) {
// https://stackoverflow.com/a/38063486
let css = document.createElement('style');
css.type = 'text/css';
if (css.styleSheet) {
css.styleSheet.cssText = rule; // Support for IE
}
else {
css.appendChild(document.createTextNode(rule)); // Support for the rest
}
@TunedMystic
TunedMystic / scanports.py
Created April 2, 2020 17:19
Scan some ports
import socket
import sys
def isOpen(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((ip, int(port)))
s.shutdown(2)
return True
@TunedMystic
TunedMystic / allEventListeners.js
Created August 10, 2019 14:20
See all event listeners on the page.
// See all event listeners on the page.
// Ref: https://stackoverflow.com/a/45842339
//
Array.from(document.querySelectorAll('*'))
.reduce(function(pre, dom){
var evtObj = getEventListeners(dom)
Object.keys(evtObj).forEach(function (evt) {
if (typeof pre[evt] === 'undefined') {
pre[evt] = 0
}
@TunedMystic
TunedMystic / changefileperms.sh
Created June 3, 2019 03:47
Change File Permissions
alias changefileperms='find . -type d -perm 777 -exec chmod 755 {} \; && find . -type f -perm 777 -exec chmod 644 {} \;'