Skip to content

Instantly share code, notes, and snippets.

@cmdoptesc
cmdoptesc / d3.slider.css
Last active Apr 6, 2020
D3: Map Timeline
View d3.slider.css
.d3-slider {
position: relative;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
border: 1px solid #aaaaaa;
z-index: 2;
}
.d3-slider-horizontal {
height: .8em;
@cmdoptesc
cmdoptesc / listing_boto3_exceptions.md
Last active Dec 11, 2019
Listing Boto3 Exceptions
View listing_boto3_exceptions.md

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 / parallel_lambda_test.py
Created Nov 22, 2019
Parallel lambda invocations with Python concurrent futures
View parallel_lambda_test.py
#!/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 / concurrent_map_test.py
Last active Nov 22, 2019
Python concurrent futures map test playground
View concurrent_map_test.py
#!/usr/bin/env python3
# concurrent_map_test.py
import random
import pendulum
import time
from concurrent import futures
from functools import reduce
@cmdoptesc
cmdoptesc / Readme.md
Last active May 15, 2019
D3: Open Hours (.csv parsing)
View Readme.md

D3: Open Hours

view on bl.ocks.org
github repo

D3 visualisation utilising D3's text/CSV to read/parse a CSV file with restaurant information and display which restaurants are currently open.

Users can drag the time (red line) to display restaurants open at other hours.

@cmdoptesc
cmdoptesc / windows_netsh_forwarding.txt
Created Jun 26, 2018
Windows port/address forwarding with netsh
View windows_netsh_forwarding.txt
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 / You_Dont_Know_JS_this_all_makes_sense_now.md
Created Apr 7, 2018
YDKJS: this & Object Prototypes, this call site, implicit, explicit binding (Kyle Simpson)
View You_Dont_Know_JS_this_all_makes_sense_now.md

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 / You_Dont_Know_JS_Scope_Closures_Lexical_this.md
Created Apr 7, 2018
YDKJS: Lexical Scope this and ES6 arrow functions (Kyle Simpson)
View You_Dont_Know_JS_Scope_Closures_Lexical_this.md

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 / facebook-privacy-guide.md
Last active Mar 28, 2018
Facebook Privacy Settings for those who still want to use Facebook
View facebook-privacy-guide.md

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 / Readme.md
Last active Mar 4, 2018
JavaScript D3: Drawing Concentric Arcs
View Readme.md
You can’t perform that action at this time.