Skip to content

Instantly share code, notes, and snippets.

View emnopal's full-sized avatar

Muhammad Naufal emnopal

  • 20:02 (UTC +07:00)
View GitHub Profile
@emnopal
emnopal / enable_paste.js
Last active March 3, 2023 07:06
Enable paste on the website
const allowPaste = e => {
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
@emnopal
emnopal / delete_playlist_youtube.js
Created December 13, 2021 11:36
Delete Youtube Playlist using JS
// Delete playlist
document.querySelector('#primary button[aria-label="Action menu"]').click();
document.querySelector("#items > ytd-menu-service-item-renderer:nth-child(3)").click();
function ClickConnect(){
console.log("Clicked on connect button");
document.querySelector("colab-connect-button").click()
}
setInterval(ClickConnect,60000)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
choice;id;hydro1;hydro2;hydro3;organic1;organic2;organic3;price1;price2;price3
3;1;1;1;0;1;0;0;200;300;0
2;1;1;1;0;0;0;0;400;100;0
1;1;1;0;0;0;1;0;100;400;0
1;1;0;1;0;1;1;0;400;100;0
2;1;1;0;0;0;1;0;300;200;0
2;1;1;0;0;1;0;0;300;200;0
1;1;1;0;0;0;1;0;200;300;0
2;1;0;0;0;1;1;0;100;400;0
2;2;1;1;0;1;0;0;200;300;0

psycopg2

LDFLAGS="-I/opt/homebrew/Cellar/openssl@3/3.1.1/include -L/opt/homebrew/Cellar/openssl@3/3.1.1/lib" pip install psycopg2

psycopg2 (alt)

brew install libpq --build-from-source
@emnopal
emnopal / generate_data.py
Created December 5, 2022 03:46
Generate Random Data using Faker
import os
import csv
import json
import time
import argparse
from faker import Faker
from decimal import Decimal
from typing import List, Dict, Any
fake_data: Faker = Faker()
#!/usr/bin/env bash
while getopts p:i: flag
do
case "${flag}" in
p) platform=${OPTARG};;
i) container_id=${OPTARG};;
esac
done
// copy and paste this to console
// url to console: https://www.linkedin.com/in/<username>/details/certifications/
let getCertification = [...document.querySelectorAll("ul.pvs-list li.pvs-list__paged-list-item")];
let certifications = [];
getCertification.forEach(ele => {
let certification = [...new Set(ele.outerText.split("\n"))];
let urlCertification = ele.querySelector("a.full-width").href;
@emnopal
emnopal / sandbox.py
Last active January 13, 2024 10:44
Python Sandbox
import ast
import re
def SafeExec(code, allowed_globals=None, allowed_builtins=None, not_allowed_chars=None):
allowed_globals = allowed_globals or {}
allowed_builtins = allowed_builtins or {}
builtins = {"__builtins__": allowed_builtins, "_": {}.__class__.__subclasses__()}
not_allowed_chars = not_allowed_chars or ""
try:
@emnopal
emnopal / example.service
Created February 12, 2024 07:56
systemd service example
[Unit]
Description=Your Service Description
After=network.target
[Service]
User=your_username
Group=your_groupname
WorkingDirectory=/path/to/your/script
ExecStart=/usr/bin/python3 /path/to/your/script.py >> /path/to/stdout.log 2>> /path/to/stderr.log
Restart=always