Test | Description |
---|---|
-e | file exists |
-f | file is a regular file (not a directory or device file) |
-s | file is not zero size |
-d | file is a directory |
-b | file is a block device |
-c | file is a character device |
-p | file is a pipe |
-L | file is a symbolic link |
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
#!/usr/bin/env python3 | |
import fileinput | |
import os | |
import random | |
import re | |
import string | |
import subprocess | |
def rand_str(k=12): |
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
#!/usr/bin/env bash | |
ROOT_DIR='/directory/with/artist/album/song' # root directory which will be traversed | |
ALBUM='Unknown Album' # only set artwork for songs in given album (for each artist) | |
pushd "$(pwd)" | |
cd "$ROOT_DIR" | |
for artist in *; do | |
cd "$artist" | |
if [ -d "$ALBUM" ]; then |
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
import time | |
import datetime | |
timestamp_format = '%Y-%m-%d %H:%M:%S,%f' # 2018-06-28 13:34:04,776 | |
epoch = datetime.datetime.utcfromtimestamp(0) # timestamp at 1970-01-01 00:00:00 | |
def timestamp_to_int(ts): | |
dt = datetime.datetime.strptime(ts, timestamp_format) | |
return int((dt-epoch).total_seconds()*1000) |
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 __future__ import print_function | |
from time import time | |
class BSFile(object): | |
def __init__(self, filename, key_func): | |
self.filename = filename | |
self.key_func = key_func | |
def find(self, key): | |
''' |
Shell initialization files are ways to persist common shell configuration, such as:
$PATH
and other environment variables- shell prompt
- shell tab-completion
- aliases, functions
- key bindings
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
ʘ‿ʘ | |
Innocent face | |
ಠ_ಠ | |
Reddit disapproval face | |
(╯°□°)╯︵ ┻━┻ | |
Table Flip / Flipping Table | |
┬─┬ ノ( ゜-゜ノ) |
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
========================================== ========================================== | |
TMUX COMMAND WINDOW (TAB) | |
========================================== ========================================== | |
List tmux ls List ^b w | |
New -s <session> Create ^b c | |
Attach att -t <session> Rename ^b , <name> | |
Rename rename-session -t <old> <new> Last ^b l (lower-L) | |
Kill kill-session -t <session> Close ^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
package hrucc; | |
import java.util.LinkedList; | |
import java.util.Queue; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import java.util.function.Consumer; | |
/** | |
* This class should be used when some object is producing stuff for some consumer and consume() is |
NewerOlder