Skip to content

Instantly share code, notes, and snippets.

View cocomod.sh
function cocomod() {
# port list all detected ports: python3 -m there detect
# run run local file on module (not send): python3 -m there run [FILE]
# list list file: python3 -m there ls -l [/] python3 -m there run [FILE]
# send send file to module: python3 -m there push [FILE] [/]
# read get source code from file on module: python3 -m there cat [FILE]
# delete delete file from module: python3 -m there rm [FILE]
# repl enter repl: python3 -m there -i
# echo "Usage: burn, goto, port, run, list, send, read, delete, repl"
View bulk_change_git_remote_url.py
import subprocess, os
current_path = os.getcwd()
current_file_list = os.listdir()
def exec_command(cmd):
command = cmd.split()
command_output = subprocess.run(command, capture_output=True)
for line in command_output.stdout.decode("utf-8").split("\n"):
print("\t\t", line)
@tommyjtl
tommyjtl / dopa-rev5_withname.stl
Last active Jun 26, 2020
Ring for lovers. License under CC 4.0 BY-SA.
View dopa-rev5_withname.stl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View batch_resize_images_for_training_on_YOLO.py
'''
requirements:
scikit-image==0.16.2
tqdm==4.45.0
'''
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import glob, random, os, time, re, time
@tommyjtl
tommyjtl / compare_file_exists.py
Last active May 16, 2020
Python script to list matching files between two different kind of format, e.g. txt and jpg
View compare_file_exists.py
import glob, os
import os.path
from os import path
direcotry_name = input("Please enter the name of the directory you want to compare: \n")
current_path = os.getcwd()
directory_path = direcotry_name
extension_name = "jpg"
print(current_path)
@tommyjtl
tommyjtl / replace_1st_character_of_a_file.py
Last active May 16, 2020
Python script to replace the first character of a file for every txt file in a directory.
View replace_1st_character_of_a_file.py
import glob, os
direcotry_name = input("Please enter the name of the directory you want to replace: \n")
current_path = os.getcwd()
print(current_path)
directory_path = "turnright"
extension_name = "txt"
index_placed_before = "0"
index_placed_after = "2"
@tommyjtl
tommyjtl / http-benchmark.md
Created Aug 3, 2019 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
View http-benchmark.md
View gps_neo6m_arduino-code.md

Declaration:

#define GpsSerial  Serial1
#define DebugSerial Serial

struct
{
  char GPS_Buffer[80];
  bool isGetData;
View esp8266_test-toolchain.sh
function esp() {
python $[esptool.py] --port=$[espPort]"$@" write_flash -fm=dio -fs=32m 0x00000 $[esptoolFirmware]
}
function esptest() {
$esptool -vv -cd nodemcu -cb 460800 -cp $[espPort] -ca 0x00000 -cf $[testCode]
sleep 0.5
echo ""
echo "entering serial monitor..."
screen $[espPort] 115200
View ar-2016-demo.html
<!doctype html>
<html><head><title>【AR Demo】AR Painting</title><meta charset="UTF-8"><link href="http://fonts.googleapis.com/css?family=Crimson+Text:400,400italic,700,700italic|Roboto:400,700,700italic,400italic" rel="stylesheet" type="text/css"><style>/*
* Copyright 2014 Quip
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0