Skip to content

Instantly share code, notes, and snippets.

@cmdoptesc
cmdoptesc / facebook-privacy-guide.md
Last active March 28, 2018 08:40
Facebook Privacy Settings for those who still want to use Facebook

Facebook Privacy Settings for those who still want to use Facebook

Only have five minutes? Read the highlights.

Facebook is an advertising platform that builds profiles about its users through their browsing history and sells them.

Google does the same with your search history and YouTube views. On the other hand, Facebook tracks you because a great number of web sites are littered with Facebook's tiny "Share / Like this" button. A user thinks the button is just there to make sharing easier, but it allows Facebook to keep a record every site the user has been on.

example of tracking button

@cmdoptesc
cmdoptesc / You_Dont_Know_JS_Scope_Closures_Lexical_this.md
Created April 7, 2018 02:27
YDKJS: Lexical Scope this and ES6 arrow functions (Kyle Simpson)

Mirror of You Don't Know JS: Scope & Closures, Appendix C: Lexical-this

You Don't Know JS: Scope & Closures

Appendix C: Lexical-this

Though this title does not address the this mechanism in any detail, there's one ES6 topic which relates this to lexical scope in an important way, which we will quickly examine.

ES6 adds a special syntactic form of function declaration called the "arrow function". It looks like this:

@cmdoptesc
cmdoptesc / You_Dont_Know_JS_this_all_makes_sense_now.md
Created April 7, 2018 02:32
YDKJS: this & Object Prototypes, this call site, implicit, explicit binding (Kyle Simpson)

Mirror of You Don't Know JS: this & Object Prototypes, this All Makes Sense Now!

You Don't Know JS: this & Object Prototypes

Chapter 2: this All Makes Sense Now!

In Chapter 1, we discarded various misconceptions about this and learned instead that this is a binding made for each function invocation, based entirely on its call-site (how the function is called).

Call-site

To understand this binding, we have to understand the call-site: the location in code where a function is called (not where it's declared). We must inspect the call-site to answer the question: what's this this a reference to?

@cmdoptesc
cmdoptesc / windows_netsh_forwarding.txt
Created June 26, 2018 01:49
Windows port/address forwarding with netsh
netsh interface portproxy show all
netsh interface portproxy add v4tov4 listenport=8081 listenaddress=127.0.0.1 connectport=8081 connectaddress=[remote-ip]
netsh interface portproxy reset
@cmdoptesc
cmdoptesc / concurrent_map_test.py
Last active November 22, 2019 02:46
Python concurrent futures map test playground
#!/usr/bin/env python3
# concurrent_map_test.py
import random
import pendulum
import time
from concurrent import futures
from functools import reduce
@cmdoptesc
cmdoptesc / parallel_lambda_test.py
Created November 22, 2019 02:56
Parallel lambda invocations with Python concurrent futures
#!/usr/bin/env python3
# parallel_lambda_test.py
import random
import pendulum
import time
from concurrent import futures
# The problem is that the AWS boto3 lambda invoke function is not truly asynchronous
@cmdoptesc
cmdoptesc / listing_boto3_exceptions.md
Last active December 11, 2019 18:46
Listing Boto3 Exceptions

Listing Available AWS Boto3 Exceptions

alexpareto commented on Jul 22, 2019

An ugly, but workable solution to find out what exceptions are available on each client from the command line:

import boto3
client = boto3.client('sns')  # or whatever client you're using
# client.exceptions.__dict__
@cmdoptesc
cmdoptesc / script-template.sh
Created November 28, 2021 21:54 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@cmdoptesc
cmdoptesc / bikes-shimano-compatibility-history.md
Created July 4, 2023 20:10
A Brief History of Shimano Compatibility by nalc

A Brief History of Shimano Compatibility by nalc / "Always gritty in Philly"

Mirror of https://old.reddit.com/r/Velo/comments/84z9p9/a_brief_history_of_shimano_compatibility/

I promised /u/thirty-five- that I would give him another writeup for the wiki, and I've got some time today so I figured why the hell not tackle drivetrain and derailleur compatibility?

As usual, the late great Sheldon Brown is a fantastic resource, but following his passing in 2008 it is rather hit or miss whether you can find compatibility information on newer stuff.

To start off with a disclaimer, this information is compiled from a variety of sources and while I believe it to be correct, there could be mistakes. Feel free to point them out and I will correct them.

To start off, we must explain how a derailleur works. At the simplest level, the point of the derailleur is to move the chain sideways at the point where it meshes with the chainrings or sprockets, forcing the chain onto the adjacent chainring or sprocket. In ye olde