Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar

Leopard627 leopard627

  • South Korea
  • 02:44 (UTC +09:00)
View GitHub Profile
@leopard627
leopard627 / submodule_pull.sh
Created January 22, 2019 09:16
git submodule update --init --recursive
git submodule update --init --recursive
fn build_computer(name: String, model: String) -> Computer {
Computer {
name: name,
model: model,
cpu: 8,
ram_size: 1024,
}
}
#[test]
fn indexed_string_test() {
let mut s = "hello slice literal";
let is_okay = &s[0..1];
let is_not_okay = &s[1];
my_dictionary = {"a": 1, "b": 2, "c": 3}
# {'a': 1, 'b': 2, 'c': 3}
my_dictionary.keys()
# dict_keys(['a', 'b', 'c'])
list(my_dictionary.keys())
# ['a', 'b', 'c']
assert 'a' in my_dictionary.keys()
@leopard627
leopard627 / zipper.py
Created January 30, 2019 16:12
zipper
e = ["a", "b", "c"]
f = [1, 2, 3]
zip(e, f)
# <zip at 0x10a37af08>
dict(e, f)
# {'a': 1, 'b': 2, 'c': 3}
gifts = ["ipad", "air-pot", "8k display"]
copy_gifts = gifts
gifts[0] = "macbook-pro"
# lets guess copy_gifts!
# 결과값을 한번 예상해보자.
gifts = ["ipad", "air-pot", "8k display"]
copy_gifts = gifts[:]
gifts[0] = "macbook-pro"
# lets guess copy_gifts!
# 결과값을 한번 예상해보자.
@leopard627
leopard627 / nerd_dict.py
Created March 28, 2019 07:14
nerd_dict.py
data = {
"key1": {
"key2": {
"key3": "help me!!"
}
}
}
data.get('key1', {}).get('key2')
data.get('key1', {}).get('key2', {}).get('key3', {})
data.get('key1', {}).get('key2', {}).get('key3', {}).get('key4', {})
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import serial
import platform
import time
import datetime
import csv
import re