- Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
- pathname - The "file/directory" portion of the URL, like
invoices/123
- search - The stuff after
?
in a URL like/assignments?showGrades=1
. - query - A parsed version of search, usually an object but not a standard browser feature.
- hash - The
#
portion of the URL. This is not available to servers inrequest.url
so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things. - state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
- pathname - The "file/directory" portion of the URL, like
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
def test_cutoffs(start_amount, start_price, buy_fee, sell_fee, end_price): | |
bought_fee = start_amount*buy_fee | |
bought_amt = (start_amount-bought_fee) / start_price | |
sold = bought_amt*end_price | |
sold_fee = sold*sell_fee | |
sold = sold-sold_fee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate Private Key and Certificate using RSA 256 encryption (4096-bit key) | |
openssl req -x509 -newkey rsa:4096 -keyout privatekey.pem -out certificate.pem -days 365 | |
# Alternatively, setting the "-newkey" parameter to "rsa:2048" will generate a 2048-bit key. | |
# Generate PKCS#12 (P12) file for cert; combines both key and certificate together | |
openssl pkcs12 -export -inkey privatekey.pem -in certificate.pem -out cert.pfx | |
# Generate SHA256 Fingerprint for Certificate and export to a file | |
openssl x509 -noout -fingerprint -sha256 -inform pem -in certificate.pem >> fingerprint.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export class StateDispatcher extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = props.state || {}; | |
this._dispatch = this.dispatch.bind(this); | |
} | |
dispatch(action) { |
There are 4 possible serialization format when using avro:
- Avro Json encoding
- Avro Data Serialization (https://avro.apache.org/docs/current/spec.html#Data+Serialization) Binary format with an header that contains the full schema, this is the format usually used when writing Avro files
- Avro Single Object Encoding (https://avro.apache.org/docs/current/spec.html#single_object_encoding) Binary format with an header with only the fingerprint/id of the schema, this it the format used by Kafka (see this
- Avro Binary Encoding (https://avro.apache.org/docs/current/spec.html#binary_encoding)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to convert a list of files using ffmpeg and powershell. This example converts to .ogv files (theora/vorbis as video/audio codecs) | |
# Please note that, if you havent done so, you should set the execution policy of powershell in order to be able to run this script. | |
# The easiest way to run this script without messing to much with execution policies is to set it for a single powershell session: | |
# powershell.exe -ExecutionPolicy Unrestricted | |
# Check: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies | |
$filenames = "1","2", "3", "4", "5","6","7" | |
$filepath = "C:\Users\Oculus\Documents\Videos\Menu\" | |
$extension = ".mp4" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: echoserver | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: echoserver | |
namespace: echoserver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by http://akarnokd.blogspot.ru/2017/09/rxjava-vs-kotlin-coroutines-quick-look.html | |
// Requires Kotlin 1.2.30 or later | |
// Uses kotlinx.coroutines library | |
import kotlinx.coroutines.experimental.* | |
import kotlin.system.* | |
suspend fun f1(i: Int): Int { | |
println("f1 attempt $i") | |
delay(if (i != 3) 2000 else 200) |
NewerOlder