Skip to content

Instantly share code, notes, and snippets.

View wulymammoth's full-sized avatar
processing unit

David W wulymammoth

processing unit
View GitHub Profile
@wulymammoth
wulymammoth / dtp_00.txt
Created October 1, 2018 16:07
daily technical problem 00
#0: Given an input, accounts, write a function to produce the given output. Feel free to ask questions
accounts = [
["John", "[email protected]", "[email protected]"],
["John", "[email protected]"],
["John", "[email protected]", "[email protected]"],
["Mary", "[email protected]"]
]
Output: [
@wulymammoth
wulymammoth / meta.txt
Created December 4, 2018 00:41
Getting ctrl + f and ctrl + b (meta) on MacOS
Open iTerm.
Go to iTerm > Preferences... > Profiles > Keys
Under Profile Shortcut Keys, click the + sign.
Type your key shortcut (option-b, option-f, option-d, option-left, etc.)
For Action, choose Send Escape Sequence.
Write b, d or f in the input field.
@wulymammoth
wulymammoth / next_permutation.py
Created January 16, 2019 19:23
Compute next "lexicographical" permutation
def next_permutation(nums):
'''
brute force:
- generate all permutations, loop and find the matching, return the next
- time: O(N^2 * N!) + O(N) [printing/string/char concatenation is the N^2]
procedure:
1. find largest increasing suffix
2. get pivot
3. find pivot's right-most successor in suffix
@wulymammoth
wulymammoth / domain_driven_design.md
Created January 21, 2019 23:30
Domain-Driven Design

Domain-driven Design (DDD)

Context mapping

Exercise to help us discover all the concepts living in our organization, and our systems

Get everyone in a room and discover the...

  • Nouns - entities
  • Verbs - events
@wulymammoth
wulymammoth / dummy-web-server.py
Created May 19, 2019 21:26 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./simple_server.py [<port>]
Send a GET request::
curl http://localhost
@wulymammoth
wulymammoth / poodir-notes.md
Created July 19, 2019 06:51 — forked from elissonmichael/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
function add(a, b) {
return a + b;
}
const cases = [
// [a, b], expectedAnswer
[[1, 2], 3], // 3
[[5, 5], 10],// 10
[[-1, 2], 1], // 1
[[1, 1], 2]
@wulymammoth
wulymammoth / values_pointers.go
Created April 22, 2020 06:58 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@wulymammoth
wulymammoth / how-to-copy-aws-rds-to-local.md
Created April 26, 2020 02:43 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored