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 flatten_dict(data, sep="."): | |
r = {} | |
for k, v in data.items(): | |
if not isinstance(v, dict): | |
r[k] = v | |
continue | |
for kk, vv in flatten_dict(v, sep).items(): | |
r[f"{k}{sep}{kk}"] = vv |
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 argparse | |
import os | |
import shutil | |
def dir_size(p): | |
return sum(os.path.getsize(f) for f in os.scandir(p) if f.is_file()) | |
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
# tested on Tf 1.15 | |
import tensorflow as tf | |
m = create_model(...) | |
m.compile(Adam(lr=1e-3), loss=["binary_crossentropy"]) | |
writer = tf.summary.FileWriter(logdir='logdir', graph=tf.get_default_graph()) | |
writer.flush() |
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 | |
FILES=$1 | |
export INCREMENT=$2 | |
for f in $(ls $FILES); | |
do | |
NEW_NAME=$(echo $f | sed -r 's/([^0-9]*)0*([0-9]*)(.*)/echo "\1$((\2 + $INCREMENT))\3"/ge') | |
echo "mv $f $NEW_NAME" | |
mv $f $NEW_NAME |
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
int MOTOR1_P = 4; | |
int MOTOR1_N = 5; | |
// the setup function runs once when you press reset or power the board | |
void setup() { | |
// initialize digital pin LED_BUILTIN as an output. | |
pinMode(MOTOR1_P, OUTPUT); | |
pinMode(MOTOR1_N, OUTPUT); |
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 python | |
# -*- coding: utf-8 -*- | |
import pygame | |
import sys | |
import time | |
from subprocess import check_output | |
threshold = 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
#!/bin/bash | |
PREV_STARUS=3 | |
while true; do | |
if (( $(nvidia-smi --query-gpu=memory.used --format=csv,nounits,noheader) > 1000 )); then | |
STATUS=0 | |
else | |
STATUS=1 | |
fi |
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 python | |
from gimpfu import * | |
import time | |
import json | |
gettext.install("gimp20-python", gimp.locale_directory, unicode=True) | |
def add_layers(img, layer, classes): |
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
$ cat .local/share/applications/gvim-tab.desktop | |
[Desktop Entry] | |
Encoding=UTF-8 | |
Name=GVim (Open in new tab) | |
Comment=Edit in a new tab | |
Exec=gvim --remote-tab-silent %F | |
Terminal=false | |
Type=Application | |
Icon=/usr/share/pixmaps/vim.svg | |
Categories=Application;Utility;TextEditor; |