Skip to content

Instantly share code, notes, and snippets.

View ezy's full-sized avatar

Ezy ezy

  • Earth
View GitHub Profile
@ezy
ezy / deletealltwitter.js
Last active December 17, 2019 00:31 — forked from Eskuero/deletealltwitter.js
Updated version of the tweet deleter and retweet undoer for the 2019 version of Twitter.
var deleteall = async function() {
// The position of the "Delete" menuitem is +1 on search pages
position = 0 + document.location.toString().includes("search?q=")
console.log("Undoing Retweets")
// Keep iterating until there's no retweet to do
while (retweet = document.querySelector('[data-testid="unretweet"]')) {
console.log(retweet)
retweet.click();
// Sleep a bit to make sure the confirm prompt appeared
await new Promise(r => setTimeout(r, 1000));
@ezy
ezy / errors.js
Created June 20, 2019 00:52
Express error handler with sentry on 500 only
app.use((err, req, res, next) => {
if (res.headersSent) next(err);
const code = err.status || 500;
const description = err.message;
// Regex 500 error to send to Sentry
const matchFHErr = /5[0-9][0-9]/g;
if (code.toString().match(matchFHErr)) Sentry.captureException(err);
// Respond with error
res.status(code).json(sendError(code, description));
});
@ezy
ezy / erase.sh
Last active June 17, 2019 00:56
Erase everything on hdd in OSX
diskutil eraseDisk JHFS+ MYDISK MBR $disk
@ezy
ezy / cert.sh
Created May 2, 2019 22:51
Ignore self signed certs
git config --global http.sslVerify false
@ezy
ezy / sentry-raw.sh
Created April 29, 2019 02:20
CURL request to sentry without an SDK
# Replace <sentry_key>, <sentry-url> and <project-id> to formulate your CURL request. Don't forget to add a trailing slash to URL otherwise you'll get wierd CSRF errors!
curl -X POST --data '{ "exception": [{ "type": "$ErrorMessage"}] }' -H 'Content-Type: application/json' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=<sentry_key>, sentry_client=raven-bash/0.1" https://<sentry-url>/api/<project-id>/store/
@ezy
ezy / multi-docker.sh
Created April 23, 2019 04:39
Shell script to run multiple docker-compose files in a microservices folder structure
#!/usr/bin/env bash
directories=$(find . -mindepth 1 -maxdepth 1 -type d)
command=""
for d in $directories
do
file="$d/compose.yml"
if [ -f $file ];
then
@ezy
ezy / a.css
Created April 8, 2019 21:24
Test css
*{background:#5d3a3a;margin:0}p{width:200;height:200;background:#b5e0ba}
@ezy
ezy / docker-compose.yml
Created April 2, 2019 02:51
docker-compose.yml for setup on OSX
version: '3.6'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- 32181:32181
environment:
ZOOKEEPER_CLIENT_PORT: 32181
@ezy
ezy / Dockerfile
Created March 18, 2019 01:57
Dockerfile for centos 7 running node 10
FROM centos:centos7
# RUN cd ~ \
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jre-8u202-linux-x64.rpm" \
# yum -y localinstall jre-8u202-linux-x64.rpm \
# rm ~/jre-8u202-linux-x64.rpm
# RUN cd ~ \
# wget -c "http://mirror.centos.org/centos/7/updates/x86_64/Packages/java-1.8.0-openjdk-headless-1.8.0.201.b09-2.el7_6.x86_64.rpm" \
# yum -y --nogpgcheck localinstall java-1.8.0-openjdk-headless-1.8.0.201.b09-2.el7_6.x86_64.rpm \
@ezy
ezy / twitter-cleanup.js
Created February 7, 2019 05:27 — forked from virenratan/twitter-cleanup.js
Delete twitter content
// delete tweets.
[].slice.call(document.getElementsByClassName('js-actionDelete')).map(tweet => {
tweet.childNodes[1].click()
document.getElementsByClassName('delete-action')[0].click()
})
// un-retweet.
[].slice.call(document.getElementsByClassName('ProfileTweet-actionButtonUndo')).map(retweet => {
retweet.click()
document.getElementsByClassName("js-close")[0].click()