Skip to content

Instantly share code, notes, and snippets.

View NatashaKSS's full-sized avatar
😬
At work, coding

Natasha Koh NatashaKSS

😬
At work, coding
View GitHub Profile
Verifying my Blockstack ID is secured with the address 191xNerXwzCRGdhDJg1MFZLj91LaFxT3H6 https://explorer.blockstack.org/address/191xNerXwzCRGdhDJg1MFZLj91LaFxT3H6
@NatashaKSS
NatashaKSS / this_keyword.md
Last active July 1, 2018 08:05
My Notes for understanding JavaScript's "this" keyword binding behaviour

My Notes for understanding JavaScript's "this" keyword binding behaviour

adapted from Chapter 2 in "You Don't Know JS" here


Key Point: The call-site determines where this will reference during the execution of a function. There are essentially 4 rules governing how the call-site determines where this will point during the execution of a function.

Rule 1. Default Binding when not in 'strict' mode

function foo() {
@NatashaKSS
NatashaKSS / README.md
Created May 23, 2018 11:16
Sample OAuth2 bearer token auth flow
@NatashaKSS
NatashaKSS / README.md
Last active April 3, 2018 09:54
Holds my GIFs
@NatashaKSS
NatashaKSS / README.md
Last active May 17, 2022 09:17
Open a new iTerm2 tab / window from a Finder shortcut

Open a new iTerm2 tab / window from a Finder shortcut

This script opens a new iTerm tab at your currently active Finder window's directory. It opens a new iTerm window there instead if you don't have iTerm running yet.

Referenced from the original tutorial written by Peter Downs at http://www.jofu.org/blog/2016/02/04/open-iterm-tab-from-finder-by-shortcut.

This is for you if...

You just want a short script with minimal configuration to get this shortcut working. For a more fully-featured solution, please use "iTerm2 Finder Tools" which you can download from Peter Down's GitHub repository.

Getting Started

@NatashaKSS
NatashaKSS / brute_force_xor_ascii.py
Last active March 31, 2018 07:37
Decrypts an ciphertext with a 1-byte XOR scheme (brute force approach)
"""
TASK:
Decrypt a piece of ciphertext which uses a 1-byte XOR Scheme.
Brute force approach.
"""
# The flag in this one contains the word "Congratulations!"
ciphertext = "W{zsfu`axu`}{zg54@|}g4}g4`|q4rxus.4wg&%$#o#%vwp&pu&'p&\"!r$%!$!&r $ur\",!!u$i:"
def decrypt(input_str):
@NatashaKSS
NatashaKSS / Substitution_Cipher_Freq_Analysis_Hack.py
Last active January 29, 2018 08:20
Simple fun Demo of Frequency Analysis w/ a Substitution Cipher
# Sample ciphertext for practice
cipher_text = "muzbpbxyenryzamvrbrzctbmxznhvzeojmvbjjzctbzhnxwrzhnowrzknzqxnovrzqzkxbqczrbqwzuqjcbxzctqvzmczrnbj"
# Function to help you make preliminary guesses of what some cipher symbols are.
# Collects the character frequency of all letters in the ciphertext
def freq(cipher_text):
result = {}
for ch in cipher_text:
if ch in result:
result[ch] += 1
@NatashaKSS
NatashaKSS / Base64_Encode_Decode.js
Last active June 21, 2017 09:39
Base64_Encode_Decode created by NatashaKSS - https://repl.it/Iulp/16
var BASE64_URL = require('base64url');
/**
* Sometimes, you need a way to quickly decode Base-64 formatted URLs into a human-editable format.
*
* Here's a short script that decodes base64 URLs and prints the decoded result onto the console.
*/
// Step 1: Enter your base URL here. E.g. it can be "https://localhost:3000" or "http://www.mysite.com"
var baseURL = ""; //TO EDIT