Skip to content

Instantly share code, notes, and snippets.

@daesu
daesu / data.json
Created January 19, 2024 12:32
Data set for technical interview
[
{ "event": "subscription", "account": "A001", "date": "2020-01-15" },
{ "event": "subscription", "account": "B0001", "date": "2020-01-23" },
{ "event": "subscription", "account": "C001", "date": "2020-01-25" },
{ "event": "reactivation", "account": "B0001", "date": "2020-04-01" },
{ "date": "2020-02-23", "account": "B0001", "event": "cancellation" },
{ "date": "2020-04-03", "account": "B0001", "event": "cancellation" },
{ "event": "reactivation", "account": "B0001", "date": "2020-05-12" },
{ "date": "2020-06-18", "account": "B0001", "event": "cancellation" },
{ "date": "2020-03-10", "account": "C001", "event": "cancellation" },
Table: company
company_id company_name city
----------- ------------------ ----------
1 ABC Ltd Stanford
2 Alpha Inc San Francisco
3 Magic Corporation New York
4 Umbrella Corp Boston
5 OCP Detroit
Table: employee
❯ curl -v --head https://rubygems.org
* Rebuilt URL to: https://rubygems.org/
* Trying 151.101.194.132...
* TCP_NODELAY set
* Connected to rubygems.org (151.101.194.132) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
❯ curl -v --head https://api.rubygems.org
* Rebuilt URL to: https://api.rubygems.org/
* Trying 151.101.130.132...
* TCP_NODELAY set
* Connected to api.rubygems.org (151.101.130.132) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
@daesu
daesu / flatten.py
Created March 10, 2016 08:05
latten an array of nested arrays of integers, discard non-ints
def flatten(List):
result = []
for i in List:
if type(i) is int:
result.append(i) # if its an int append to result list
else:
if type(i) is list: #If it's not a list, skip
result += flatten(i)
return result