Skip to content

Instantly share code, notes, and snippets.

View GroomedGorilla's full-sized avatar
:octocat:

Julian Zammit GroomedGorilla

:octocat:
View GitHub Profile
@GroomedGorilla
GroomedGorilla / dict_diff.py
Created April 18, 2023 17:03
Quick and Dirty Difference between dicts
for key, value in object_1.items():
if object_2[key] != value:
outliers[key] = {"object_1" : object_2[key], "object_2": value}
@GroomedGorilla
GroomedGorilla / dis_sum_anonymous_function.py
Last active March 10, 2023 19:53
Anonymous vs Named Functions Bytecode comparison
# Summing via Anonymous Function
import dis
dis.dis(lambda x, y: x+y)
# output - using Python v.3.10.2
1 0 LOAD_FAST 0 (x)
2 LOAD_FAST 1 (y)
4 BINARY_ADD
@GroomedGorilla
GroomedGorilla / dis_sum_anonymous_function.py
Created March 7, 2023 10:27
Anonymous Function Sum Bytecode
import dis
dis.dis(lambda x, y: x+y)
# outputs
1 0 LOAD_FAST 0 (x)
2 LOAD_FAST 1 (y)
4 BINARY_ADD
6 RETURN_VALUE
@GroomedGorilla
GroomedGorilla / JZ-Cobalt2-Mod.zsh-theme
Created October 17, 2019 14:22
Slight mod/personalisation to Wes Bos' Cobalt2 theme for ZSH
#
# Cobalt2 Theme - https://github.com/wesbos/Cobalt2-iterm
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
##
### Segment drawing
# A few utility functions to make it easy and re-usable to draw segmented prompts
@GroomedGorilla
GroomedGorilla / filter-array.js
Created May 28, 2019 18:49
Remove one element from object
let objB = {id : '123', name: 'JZ', craving: 'burgers'};
(({id, ...others }) => ({...others}))(objB);
@GroomedGorilla
GroomedGorilla / stripe_connect_custom_acct_forms.html
Last active February 28, 2019 01:34
Stripe Connect Custom Account Signup Forms
<!-- NOTES:
- These forms may not necessarily cover all fields required for a custom account signup, and should be considered a work in progress (at least until I get this working and can confirm they suffice)
- The country lists below are ISO-3166-1 Alpha-2 compliant. They make up fairly large chunks of the follow code. Would recommend exporting to a separate file and including as needed.
- I've included Bootstrap styling for easier organisation, but apply styling as needed. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@GroomedGorilla
GroomedGorilla / getSurreyGDPR.js
Last active July 2, 2018 10:21
Snippet to untick all (~266) Partner boxes when managing GDPR settings on www.getsurrey.co.uk
// FIRST ADD ID OF CHOICE (IN MY CASE 'bob' TO THE LIST YOU WISH TO UNTICK)
var a = document.getElementById('bob')
[...a.querySelectorAll('.gdpr-checkbox')].forEach(box => {
box.getElementsByTagName('input')[0].checked = false;
})
//The site seems to have a script that re-ticks all boxes from time to time, so be sure to click the submit button with
//your console open and all boxes unticked
@GroomedGorilla
GroomedGorilla / ToMAdBlock.js
Created May 22, 2018 12:40
Drop this in your console to get rid of the ridiculous whitespace ads on Times of Malta
[...document.querySelectorAll('a.ad_takeover')].forEach(ad => ad.style.visibility = 'hidden');
document.getElementById('widget_careers').style.visibility = 'hidden'
@GroomedGorilla
GroomedGorilla / recruiterBGone.js
Last active November 5, 2018 01:06
LinkedIn Recruitment Filtering (based off Wes Bos's vid)
//Run on LinkedIn's "Manage Invitations" page in your browser Console. Will Accept anyone except for those with a recruitment or consultant-related headline
//(Add your own filters to cover more terms)
[...document.querySelectorAll('.invitation-card')].forEach(card => {
const headline = card.querySelector('.invitation-card__occupation').textContent;
const acceptBtn = card.querySelector('button[data-control-name="accept"]');
const name = card.querySelector('.invitation-card__name').textContent;
if (headline.match(/recruit/gi) || headline.match(/consult/gi)) {
console.log(`I'll pass on ${name} 🙉`)