Skip to content

Instantly share code, notes, and snippets.

View jpigla's full-sized avatar
🌤️
doing something

Jan-Philipp Igla jpigla

🌤️
doing something
View GitHub Profile
const HALF_OPEN_WIDTH = 80
// this value starts as -1
// and is updated when the sidebar is updated the first time
// this is the width to which the sidebar will resize when it is fully open
let SIDEBAR_WIDTH = -1
// state enumerator, can only be closed, half-closed, and open
const state = {
closed: 0,
halfClosed: 1,
@jpigla
jpigla / content.js
Last active February 17, 2023 09:02
Boost for Arc Browser (https://arc.net/) - "SERP Result Hightlighter" (Website: "www.google.com")
/* This runs after a web page loads */
(function() {
const options = { "computerbild.de": "#ee5253", "autobild.de": "#2980b9" }
if (options) {
const domains = Object.keys(options);
console.log(domains)
const searchResultsTopStories = document.querySelectorAll("div.MkXWrd");
const searchResults = document.querySelectorAll("div.g");
searchResultsTopStories.forEach(function(result) {
/*CloudHill's Bulleted List Mod*/
div.notion-selectable.notion-bulleted_list-block
> div > div:last-child {
position: relative;
}
div.notion-selectable.notion-bulleted_list-block
> div > div:last-child::before {
content: "";
position: absolute;
@jpigla
jpigla / cheat-sheet-pandas.py
Created May 25, 2022 14:23
Cheat Sheet Python Pandas
# === Pandas ==================================================================================================================
# === Pandas / Module + Settings ==============================================================================================
# Import Dataframe library
import pandas as pd
# Pandas Settings for better output in Jupyter Notebooks
pd.set_option('display.max_colwidth', None)
@jpigla
jpigla / get_crux_data.py
Created May 19, 2022 12:55
Get CrUX Data from Google with Python
# --- Open the file containing the list of URLs ------------------------------------------------------------------------
urls_file = open('urls.txt', 'r')
url_list_file = urls_file.readlines()
# url_list_file = pd.read_csv('urls.csv', header=None).drop_duplicates()[0].to_list()
# --- Set parameters and variables --------------------------------------------------------------------------------------
# Get date of today
@jpigla
jpigla / .zshrc
Last active May 19, 2022 11:55
ZSH Functions (Shell)
# create requirements.txt from Jupyter Notebook file ($1 = name of file)
pipreqs_nb() {
if [ -z "$1" ]; then
echo "Select a notebook to convert"
else
{
jupyter nbconvert --output-dir="./reqs" --to script $1.ipynb
cd reqs
@jpigla
jpigla / paas_from_google.js
Created April 19, 2022 22:03
Bookmarklet: PAAs from Google
javascript:(function(){
divClasses = document.getElementsByTagName("div");
output = "<html><head><title>PPAs for \"" + document.title.split(" - ")[0] + "\"</title><style type='text/css'>body{font-family:Tahoma,Verdana,Segoe,sans-serif;font-size:18px;color:#2c3e50;margin:30px}h1{color:#34495e;font-size:20px;margin-bottom:5px}</style></head>";
output += "<body><h1>PPAs for \"" + document.title.split(" - ")[0] + "\"</h1><ol>";
for (i = 0; i < divClasses.length; i++) {
if (divClasses[i].getAttribute("class") == "iDjcJe IX9Lgd wwB5gf") {
output += "<li>" + divClasses[i].childNodes[0].innerHTML + "</li>"
}
}
output += "</ol></body></html>";
@jpigla
jpigla / philipps_module.py
Last active February 15, 2022 01:19
Philipps Collection of Python Functions
# /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/philipps_module.py
# get latest ip addresses for google bot and bing bot (15.02.2022)
# https://gist.github.com/eliasdabbas/169cc580f8d10a63d5a5d3df04ef9758
def get_bot_ip_addresses():
"""
get latest ip addresses for google bot and bing bot
"""
import ipaddress
javascript:void%20function(){var%20b=Number.NEGATIVE_INFINITY;function%20a({name:a,delta:b,verdict:c}){var%20d,d;null==(d=document.getElementById(%22webVitalsHolder%22))%26%26((d=document.createElement(%22div%22)).id=%22webVitalsHolder%22,d.style.position=%22fixed%22,d.style.bottom=0,d.style.left=0,d.style.margin=%225px%22,d.style.padding=%225px%22,d.style.fontFamily=%22monospace%22,d.style.fontSize=%221.5rem%22,d.style.backgroundColor=%22%23fff%22,d.style.color=%22%23000%22,d.style.border=%221px%20solid%20%23000%22,d.style.borderRadius=%220.5rem%22,d.style.boxShadow=%220%2025px%2050px%20-12px%20rgba(0,0,0,.25)%22,d.style.zIndex=%22999999%22,document.body.appendChild(d));var%20e=document.getElementById(%22webVital-%22+a);if(null!=e)0===c%3Fe.style.color=%22%230cce6b%22:1===c%3Fe.style.color=%22%23ffa400%22:2===c%26%26(e.style.color=%22%23ff4e42%22),e.innerText=`%20${a}:%20${b}`;else{var%20f=document.createElement(%22span%22);f.id=%22webVital-%22+a,0===c%3Ff.style.color=%22%230cce6b%22:1===c%3Ff.style.color=%2
@jpigla
jpigla / github.md
Last active February 19, 2021 15:40
Github Tips