Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar

Leopard627 leopard627

  • South Korea
  • 16:39 (UTC +09:00)
View GitHub Profile
try:
assert requests.get("googlgg.com").status_code == 200
assert requests.get("abcx.com").status_code == 200
except AssertionError:
print("?!")
@leopard627
leopard627 / fzf_bat.sh
Created August 2, 2019 10:14
fzf + bat magic
export FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --preview 'bat --color=always --style=header,grid --line-range :300 {}'"
use std::fs::File;
use std::io;
use std::io::Read;
fn beginner() -> Result<String, io::Error> {
let f = File::open("hello.txt");
let mut f = match f {
Ok(file) => file,
Err(e) => return Err(e),
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
data.get('key1', {}).get('key2')
data.get('key1', {}).get('key2', {}).get('key3', {})
data.get('key1', {}).get('key2', {}).get('key3', {}).get('key4', {})
@leopard627
leopard627 / nerd_dict.py
Created March 28, 2019 07:14
nerd_dict.py
data = {
"key1": {
"key2": {
"key3": "help me!!"
}
}
}
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 / 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}
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()