s = "abcABCabc"
d = set(s) # {'a', 'b', ... }
l = list(s) # ['a', 'b', ... ]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select_kth_element(nums: List[int], k) -> Optional[int]: | |
# returns k-th largest element | |
# 1 <= k <= len(nums) | |
# if the list is less than size k it returns None | |
if len(nums) < k or k < 1: | |
return None | |
k = len(nums) - k | |
def quick_select(numbers: List[int], start, end) -> int: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
# sort in place | |
def qsort(num_list: List[int]): | |
def _qsort(nums: List[int], start: int, end: int): | |
if end-start <= 0: | |
return | |
pivot = num_list[end] |
I hereby claim:
- I am cun3yt on github.
- I am cmertayak (https://keybase.io/cmertayak) on keybase.
- I have a public key ASBqoaRz9fV3J2Gfgh2jsp9v62wB8Iq_buo7s3541TLplgo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * FROM | |
(values ('1007163', 2016, 3, 80.09), ('1034758',2013,4,68.85)) | |
T2(person_id_t2, id_yr_t2, id_qtr_t2, score) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_mapping = {'a': 23, 'b': 42, 'c': 0xc0ffee, 'hede': {'zap': 12}} | |
print(json.dumps(my_mapping, indent=2, sort_keys=True)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Typically you want the `.ssh` directory permissions to be `700 (drwx------)` and the public key (`.pub` file) to be `644 (-rw-r--r--)`. Your private key (`id_rsa`) should be `600 (-rw-------)`. | |
I am asssuming that you mean that you have to enter your system/user password each time, and that previously you did not have to. cdhowie's response is assuming you set a password/passphrase when generating your keys, and if you did then as he says you will have to enter your password every time unless you use an ssh agent. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your delay will be between 0 and x, so set this value yourself. This should run every 12 hours, with a random delay. | |
# | |
# Make sure this is run using bash. | |
# | |
# From [Unix StackExchange](http://unix.stackexchange.com/questions/333197/running-a-script-via-cron-at-a-random-time-but-a-certain-number-of-times-per-da) | |
0 */12 * * * sleep $((RANDOM%x)) && /bin/sh -c /path/to/script.sh |