As configured in my dotfiles.
start new:
tmux
start new with session name:
function rot13(encodedStr) { | |
var alphabet = "abcdefghijklmnopqrstuvwxyz".toUpperCase().split(""); | |
var codeArr = encodedStr.split(""); | |
var decodedArr = []; | |
decodedArr = codeArr.map(function(a) { | |
if(alphabet.indexOf(a)!==-1) { | |
if(alphabet.indexOf(a)<13) { | |
return alphabet[26+alphabet.indexOf(a)-13]; | |
} else { | |
return alphabet[alphabet.indexOf(a)-13]; |
import numpy as np | |
def cartesian(arrays, out=None): | |
""" | |
Generate a cartesian product of input arrays. | |
Parameters | |
---------- | |
arrays : list of array-like | |
1-D arrays to form the cartesian product of. |
As configured in my dotfiles.
start new:
tmux
start new with session name:
# application.py | |
from flask import Flask, render_template_string | |
from flask_sqlalchemy import SQLAlchemy | |
db = SQLAlchemy() | |
class User(db.Model): | |
""" |
# https://stackoverflow.com/q/52613778/3135417 | |
# Function to keep track of diff changes along the V1 column | |
get_ids <- function(x) { | |
vrle <- rle(cummin(x))$lengths | |
rep(1:length(vrle), vrle) | |
} | |
# Thesis data | |
thesis <- data.frame(V1=c(8628, 8626, 8624, 8622, 8620, 8618, |
# persons.txt | |
# Person 1 | |
# Class Grade | |
# Math A | |
# Science C | |
# English A | |
# Person 2 | |
# Class Grade | |
# Math D | |
# English A |
#!/usr/bin/env python3 | |
""" | |
Script to test or run commands on given servers. | |
./this_script.py test # To test all servers | |
./this_script.py run --id 127.0.0.1 --command "echo hello world" | |
""" | |
from argparse import ArgumentParser, RawDescriptionHelpFormatter as RDHF | |
def test_servers(servers): |
# The arbitrary and opinionated conversion of strings to datetime in Series comparisons | |
# When comparing two values where the left side values is a pandas datetime object, | |
# Pandas casts the left side values to pd.DatetimeIndex | |
# Once the casting is successfully, Pandas then calls the __eq__ method on the result of the cast operation. | |
# In this case, you want to take a look at pd.DatetimeIndex.__eq__ to figure out how the comparison is being handled | |
# The following is how pd.DatetimeIndex.__eq__ is defined (it's a decorated function, so the function name doesn't come up): | |
def wrapper(self, other): |
I hereby claim:
To claim this, I am signing this object:
# There is really not a dynamic way of doing what you want. | |
# You will need to expand the dash and generate a sequence from it. | |
# I wrote an example function that converts something like 2-4 into seq(2, 4) | |
expand.dash <- function(dashed) { | |
limits <- unlist(strsplit(dashed, '-')) | |
seq(limits[1], limits[2]) | |
} | |
# We can use the above function inside another function which expands ballrooms |