Skip to content

Instantly share code, notes, and snippets.

View AymaneHrouch's full-sized avatar
💭
Kaizen

Aymane Hrouch AymaneHrouch

💭
Kaizen
  • Société Générale Africa Technologies & Services
  • Casablanca, Morocco
View GitHub Profile
@AymaneHrouch
AymaneHrouch / SolutionTriangleCodingChallenge.java
Last active December 11, 2022 13:01
My solution to the triangle coding challenge.
// Challenge description:
// Make a function that takes as an argument n the number of lines, and output a triangle a triangle drawed by stars.
// Example: for n = 3
// *
// ***
// *****
public class SolutionTriangleCodingChallenge {
public static void draw(int n) {
int total = 1 + 2*(n-1); // number of stars in the last line
@AymaneHrouch
AymaneHrouch / init_raspberrypi.sh
Last active September 3, 2023 20:47
Bash script to run on the first time working with a raspberrypi, (installs nodejs, npm, chromium-browser, noip, and sets a static ip)
#! /bin/bash
RED="\e[31m"
ENDCOLOR="\e[0m"
echo -e "${RED}Updating packages list${ENDCOLOR}\n\n"
sudo apt update
echo -e "${RED}Installing Node.js${ENDCOLOR}\n\n"
sudo apt --assume-yes install nodejs
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
@AymaneHrouch
AymaneHrouch / Cancel Sent Requests Bookmark.js
Last active May 12, 2020 17:52
Bookmark to cancel pending sent requests on Facebook.
// COPY JUST THE LINE BELOW //
javascript:var validUrl = new RegExp("https://m(obile)?.facebook.com/friends/center/requests/outgoing.*"); if(validUrl.test(document.URL)){if(confirm("Are you sure?\nPress OK to confirm")){var requestsNumber = document.querySelectorAll('[data-sigil="undoable-action"]').length; for (var i=0; i < requestsNumber; i++) {document.querySelectorAll('[data-sigil="undoable-action"]')[i].children[1].children[0].children[2].children[2].children[0].click(); } alert(`${requestsNumber} request has been cancelled successfully`);}}else{if(confirm("Press OK to be redirected...")){window.open("https://m.facebook.com/friends/center/requests/outgoing");}}
// COPY JUST THE LINE ABOVE //
/*
PLEASE READ BELOW INSTRUCTIONS:
-Make a new bookmark and paste that line in the URL field, choose any title you want
-You can go to "https://m.facebook.com/friends/center/requests/outgoing/" manually
-Or you can just click the bookmark wherever you are and it will redirect you
// Visit : https://mobile.facebook.com/friends/center/requests/outgoing/
// scroll as much as you can
// past below code to the console, press enter and you're done!
//
//
let requests = document.querySelectorAll('[data-sigil="undoable-action"]');
for (i=0; i < requests.length; i++) {
requests[i].children[1].children[0].children[2].children[2].children[0].click();
}
alert(`${requests.length} request has been cancelled successfully`);
@AymaneHrouch
AymaneHrouch / autosub_reddit.js
Last active April 20, 2024 19:11
Auto subscribe to a lot of subreddits after you move to a new account.
/*
-Visit https://old.reddit.com/subreddits/ using your old account
-Copy link address of "multireddit of your subscriptions"
It will give you a link address like this: https://old.reddit.com/r/[subreddit1+subreddit2...+subredditN]
Please note that if you have a lot of subreddits the link won't work because there's a limit to the link's length, you can simply split it to two or three links
-Visit that link (or links) using your new account.
-Open the console by pressing F12 and then clicking the console tab
-Past the code bellow and press enter. You're welcome :)
*/
const sub = () => {