Skip to content

Instantly share code, notes, and snippets.

@jzbruno
jzbruno / interview.md
Last active April 30, 2024 19:55
interview_2024042006

Exercise

  1. Connect to the Linux server running in AWS

    • Host =
    • User = ec2-user
    • Private key = See the interview.pem file of this page
  2. Download the application binary to the Linux server

@jzbruno
jzbruno / interview.md
Last active April 18, 2024 16:11
interview

Exercise

TEST

  1. Connect to the Linux server running in AWS

    • Host =
    • User = ec2-user
    • Private key in this gist
@jzbruno
jzbruno / git-update-fork.sh
Last active September 16, 2020 03:57
git-update-fork
# git remote add upstream <origin-url>
git fetch upstream
git merge upstream/master
git push origin master
@jzbruno
jzbruno / git-repo-backup
Last active February 27, 2020 04:33
Example for archiving a git repo
git clone --mirror <clone-url>
cd reponame
git bundle create ../reponame.bundle --all
@jzbruno
jzbruno / create_files_with_dates.sh
Last active December 22, 2016 22:35
Create a set of files begining with the date in YYYMMDD format
create_files_with_dates () {
file_name=$1
num_days=$2
tmp_dir="tmp/"
mkdir -p $tmp_dir
for ((i=0; i <= $1 - 1; i++)); do
day=`date -j -v-${i}d +%Y%m%d`
> ${tmp_dir}${day}${file_name}
@jzbruno
jzbruno / get_nested_value.py
Last active November 11, 2016 17:37
Get a nested value from a dictionary using a period separated list of keys.
def get_nested_value(originalDict, path):
keys = path.split('.')
val = originalDict
for key in keys:
val = val.get(key)
return val
@jzbruno
jzbruno / bash_iterate_array.sh
Created November 2, 2016 19:20
Bash iterate array
#!/bin/bash -e
array=(
one
two
three
)
for item in "${array[@]}"; do
echo $item
@jzbruno
jzbruno / click_conditional_options.py
Last active April 5, 2021 19:04
An example of conditionally prompting for options when a flag is set using the click library.
import click
def prompt_proxy(ctx, param, use_proxy):
if use_proxy:
host = ctx.params.get('proxy_host')
if not host:
host = click.prompt('Proxy host', default='localhost')
port = ctx.params.get('proxy_port')
@jzbruno
jzbruno / check_time_between.py
Created February 16, 2015 00:02
Check if the current time is in between two times.
"""
Example of checking wether the current time is between
a start and end time. This assumes no access to timespan like functions
and is why the times are integers.
Use nose to run tests with `nosetests check_time_between.py`
"""
def test_before_window():