Skip to content

Instantly share code, notes, and snippets.

View gholm's full-sized avatar
💭
I may be slow to respond.

SG gholm

💭
I may be slow to respond.
View GitHub Profile
@cspence001
cspence001 / bpcupdate.py
Last active September 5, 2024 19:08
Updates the BPC Chrome extension (installed via "Load Unpacked" in Developer Mode) after verifying the SHA-256 hash of the extension’s ZIP file. On match, the script extracts and updates the extension.
#!/usr/bin/env python3
# Verifies the SHA-256 hash of a downloaded file from (https://gitflic.ru/project/magnolia1234/bpc_uploads) against the hash in [release-hashes.txt](https://github.com/bpc-clone/bypass-paywalls-chrome-clean/blob/master/release-hashes.txt).
# 1. Downloads the hash file from the [HASH_URL] and extracts the expected hash for the correspondent [FILENAME].
# 2. Downloads the zip-file [FILENAME] from [DOWNLOAD_URL] and calculates its SHA-256 hash.
# 3. Compares the calculated hash with the expected hash.
# 4. On match, prompts the user to move the file to a permanent location [DOWNLOAD_DIR].
# 5. Moves and extracts the file if confirmed; otherwise, deletes the temporary file.
# Note: Before running script, replace [DOWNLOAD_DIR] with permanent location on your computer that you use for your extension, excluding the extracted folder name [EXTRACT_DIR_NAME].
import requests
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@saksters
saksters / group-gsc-dates-to-week.py
Created March 15, 2021 19:46
Groups GSC daily clicks together into weekly intervals from Sunday to Saturday
import pandas as pd
df = pd.read_csv('Dates.csv')
df['Date'] = pd.to_datetime(df.Date)
df_week = df.resample('W-SAT', on='Date').Clicks.sum()
df_week.to_csv('export.csv')
@almirb
almirb / mysql_backup.cmd
Last active January 2, 2023 22:01
MySQL Backup Batch Script (Windows) for 7 day persistence with hour prefix.
@echo off
:: make sure to change the settings from line 4-9
set dbUser=backup
set dbPassword="MyBackupUserPass"
set backupDir="C:\laragon\bkp\mysql"
set mysqldump="C:\laragon\bin\mysql\mysql-5.7.24-winx64\bin\mysqldump.exe"
set mysqlDataDir="C:\laragon\data\mysql"
set zip="C:\Program Files\7-Zip\7z.exe"
@amboutwe
amboutwe / wordpress_robots_custom.php
Last active July 10, 2024 17:50
Filters and example code for Yoast SEO robots or WP robots.txt
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: June 09 2020 using WordPress 5.4.1
*/
add_filter('robots_txt','custom_robots');
@renestalder
renestalder / README.md
Last active June 30, 2024 14:55
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@Chaser324
Chaser324 / GitHub-Forking.md
Last active September 3, 2024 21:12
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j