Skip to content

Instantly share code, notes, and snippets.

@ksred
ksred / scratch.json
Last active October 2, 2020 12:26
Example Travel Advice API response
{
"name": "Your Itinerary",
"start_date": "2020-10-01T11:18:07.484051313Z",
"risk_level": "amber",
"recommendation": "We recommend caution when booking your trip due to multiple restrictions in place. Also, one of the destinations in this itinerary has a containment and health index of 67%, which is an indicator of how closed the country is to travelers; a stringency index of 63% which determines how challenging it will be to move within the country, attend events, conduct business and access public transportation; and an economic support index of 100% which indicates how much was spent in countering the inpact of the pandemic on the economy.",
"requirements": {
"tests": "required",
"quarantine": "required",
"masks": "required"
},

Keybase proof

I hereby claim:

  • I am ksred on github.
  • I am ksred (https://keybase.io/ksred) on keybase.
  • I have a public key ASAmNZsLNrZ-WVah4TGweFzuF18mlPsB-_7kQV8cqS4Nqgo

To claim this, I am signing this object:

@ksred
ksred / gist:1e3e3d3e268fa1caea91
Last active August 29, 2015 14:11
Time interval cache invalidation
/*
* Used to invalidate cache by three URIs and a timestamp
*
* Cache invalidation only happens after a certain predefined time has passed
* Two times are set, one for normal slow data, another for faster data (live)
* These are defined as constants CACHE_VALID and CACHE_VALID_LIVE
* The timestamp of the files on disk is used to check when last the files were written
* and then invalidated if that time is longer than set time
*
* @param one (string) first URI, default "default"
@ksred
ksred / bash ssh executing commands
Created January 23, 2014 11:32
An intermediate example of sending a file to another server using SSH. In this example, we also import a database on remote server.
#! /bin/bash
echo "It is suggested that you add this server's public key to the remote server. Copy the following into ~/.ssh/authorized_keys on remote server under root user"
cat ~/.ssh/id_rsa.pub
echo "Enter in file name, must be tar.gz file for this example"
read FILENAME
echo "Enter in local directory where file is currently"
read BASE
@ksred
ksred / bash loop and if example
Created January 23, 2014 11:10
Basic example to show usage of infinite while loop and string based if statement
#! /bin/bash
echo “Are you ready to begin? (y/n)”
read READY
while :
do
if [ “$READY” == “n” ]
then
echo “Are you ready now?”
read READY
@ksred
ksred / bash IO example
Last active May 31, 2018 23:42
Bash example showing basic input and output
#! /bin/bash
#A comment stating what this program is about
#Taking input, showing output
echo “Please enter in a variable”
read VARIABLE
echo “The variable you entered is: $VARIABLE”
#Taking in arguments
#Usage: ./script.sh var1 var2 var3