Skip to content

Instantly share code, notes, and snippets.

@alyssaq
alyssaq / timezone-abbreviations.csv
Last active February 13, 2024 08:01
Timezone abbreviations to name and UTC offset
Abbreviation. Name UTC offset
ACDT Australian Central Daylight Time +10:30
ACST Australian Central Standard Time +9:30
ACT Acre Time -5
ACT Australian Central Time +9:30 / +10:30
ACWST Australian Central Western Standard Time +8:45
ADT Arabia Daylight Time +4
ADT Atlantic Daylight Time -3
AEDT Australian Eastern Daylight Time +11
AEST Australian Eastern Standard Time +10
@alyssaq
alyssaq / static IP to VM.md
Last active February 13, 2024 08:01
Create a VM in virtualbox with a static IP to allow ssh - ubuntu 16.04 amd64

Create a host-only network

In the virutal box UI, Global Tools tab > create vboxnet0 host network with DHCP disabled (untick Enable Server).

Create/modify a VM with host-only network

Select the VM (it must be shut down to add a 2nd network adapter) > Settings > Network tab > Adapter 2 > Attach Host-only adapter and vboxnet0

Set static IP in VM (ubuntu 16.04 amd64)

Start the VM.
Edit /etc/network/interfaces

@alyssaq
alyssaq / countries_continents.csv
Last active May 28, 2024 23:56
country and continent codes
continent_code country_code continent_name country_name
AS AF Asia Afghanistan
EU AX Europe Åland Islands
EU AL Europe Albania
AF DZ Africa Algeria
OC AS Oceania American Samoa
EU AD Europe Andorra
AF AO Africa Angola
NA AI North America Anguilla
AN AQ Antarctica Antarctica
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import logger from 'redux-logger'
import rootReducer from '../reducers'
import { debounce } from 'lodash'
let prevFilter = ''
function dispatchData(dispatch, data, numRows) {
const allData = data.displayData
@alyssaq
alyssaq / plot.py
Created November 2, 2017 11:51
Different y scales with datetime x-axis
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
t = datetime.datetime.now().date()
varr = range(10)
tarr = matplotlib.dates.date2num([t + datetime.timedelta(days=i) for i in varr])
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
@alyssaq
alyssaq / aws-alias.txt
Created September 28, 2017 13:19
aws alias
alias aws-get='export instanceId=`aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=p2.xlarge" --query "Reservations[0].Instances[0].InstanceId" --output text` && echo $instanceId'
alias aws-start='aws ec2 start-instances --instance-ids $instanceId && aws ec2 wait instance-running --instance-ids $instanceId && export instanceIp=`aws ec2 describe-instances --filters "Name=instance-id,Values=$instanceId" --query "Reservations[0].Instances[0].PublicIpAddress" --output text` && echo $instanceIp'
alias aws-ip='export instanceIp=`aws ec2 describe-instances --filters "Name=instance-id,Values=$instanceId" --query "Reservations[0].Instances[0].PublicIpAddress" --output text` && echo $instanceIp'
alias aws-ssh='ssh -i ~/.ssh/aws-ec2.pem ubuntu@$instanceIp'
alias aws-stop='aws ec2 stop-instances --instance-ids $instanceId'
alias aws-state='aws ec2 describe-instances --instance-ids $instanceId --query "Reservations[0].Instances[0].State.Name"'
alias aws-nb='export ins
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alyssaq
alyssaq / main.go
Last active June 20, 2018 03:58
GET and POST golang API
/*
* Sample API with GET and POST endpoint.
* POST data is converted to string and saved in internal memory.
* GET endpoint returns all strings in an array.
*/
package main
import (
"encoding/json"
"flag"
@alyssaq
alyssaq / main.go
Last active February 13, 2024 08:01
GET and POST golang API
/*
* Sample API with GET and POST endpoint.
* POST data is converted to string and saved in internal memory.
* GET endpoint returns all strings in an array.
*/
package main
import (
"encoding/json"
"flag"
@alyssaq
alyssaq / README.md
Last active February 13, 2024 08:01 — forked from jinroh/README.md
Fourier series visualisation with d3.js.

From Wikipedia:

In mathematics, a Fourier series decomposes periodic functions or periodic signals into the sum of a (possibly infinite) set of simple oscillating functions, namely sines and cosines (or complex exponentials).

Use the bottom right form to change the visualized series.