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 haversine as hs | |
from haversine import haversine, haversine_vector, Unit | |
import pandas as pd | |
import numpy as np | |
import json | |
print('hello') | |
lat=30.393000 | |
lon=-98.070050 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 math import log10 | |
def eng_str(x, significance=8, precision=3): | |
y = abs(x) | |
exponent = int(log10(y)) | |
engr_exponent = exponent - exponent%3 | |
z = y/10**engr_exponent | |
if x < 0: | |
z=z*-1 | |
if engr_exponent > 0: | |
exp_str=f"+{engr_exponent:03}" |
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
# Basic 101 list commands for .tcl (cannot do $X[$index] has to be [lindex $X $index]) | |
set X [list] ;# NOTE! Good practce to start with empty list (.tcl is calling [] function "list" and returning an empty list) | |
lappend X a b c ; puts $X ;# a b c | |
#lappend X {d e f} ; puts $X ;# a b c {d e f} ;# NOTE! This is probably not what you wanted! Creates list of list | |
lappend X {*}{d e f} ; puts $X ;# a b c d e f ;# NOTE! The {*} tells tcl to expand the list before appending | |
set X [lreplace $X 1 1 B] ; puts $X ;# a B c d e f ;# NOTE! lreplace does not modify the origianl list so must assign it back | |
set X [lreplace $X 2 3 C D] ; puts $X ;# a B C D e f | |
set X [lreplace $X 2 2] ; puts $X ;# a B D e f ;# Delete list element by replacing it with nothing | |
set X [lreplace $X 3 4] ; puts $X ;# a B D | |
set idx [lsearch $X "B"] ;# Search for index by value |
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
# I have a file.txt containing numbers like | |
1, 2, 3 | |
4, 5 | |
6, 7, 8, 9,10,11 | |
12,13,14,15,16 | |
# I want to create a CSV file by padding each line such that there are 6 values separated by 5 commas, so I need to add to each line an appropriate number of ",0". It shall look like | |
1, 2, 3, 0, 0, 0 | |
4, 5, 0, 0, 0, 0 | |
6, 7, 8, 9,10,11 | |
12,13,14,15,16, 0 |
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
function xchrome() { | |
read -r -d '' HELP_MSG << END_HELP_MSG | |
Description: | |
Open webpage in chrome from terminal (and search for string "my_string") | |
Installation: | |
Add this function to your .bashrc | |
Known limitiations: | |
find string can only contain [a-zA-Z_] | |
URL cannot have anchors /path/to/html.html#anchor |
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
# Do not use in public facing servers as I am sure it can do bad things by malicious individuals | |
# Initialize variables and functions | |
unset -f boo | |
unset -f echoerror | |
unset other | |
echoerr() { printf "%s\n" "$*" >&2; } | |
# Example bash function to show the use of: | |
# required args "rqrd_arg" | |
# named args "namd_arg" |
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
#!/home/smeckley/py/venvs/venv1/bin/python | |
# All the steps required to get this simple plot: | |
# 1) Install VM VirtualBox on my windows machine | |
# 2) Download LinuxMixt (LMDE4) .iso | |
# 3) Create new VM for Linux Ubuntu and load .iso into the virtual optical drive | |
# 4) Startup the VM and click on "install" icon on the desktop (follow propmts) | |
# 5) Once finished with the basic install we need to enable "Guest Additions" to share clipboard/resize screen (all the goodies) VM->Devices->"Install Guest Additions CD Image" and run that | |
# 6) Install gvim (WTF!!) "sudo apt install vim-gtk3" | |
# 7) Get Python working with the correct libraries | |
# sudo su |
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
proc xdbg { } { puts $::errorInfo }; # This must be the first proc and be as simple as possible so we are always able to debug | |
# Define required globals | |
set ::xhelpMsgs [dict create] | |
set ::xVerbosity INFO | |
# Define the verbosity levels (based on python logging levels: https://verboselogs.readthedocs.io/en/latest/readme.html ) | |
set ::verbosityLevel [dict create] | |
dict append ::verbosityLevel NOTSET 0 ;# When a logger is created, the level is set to NOTSET (note that the root logger is created with level WARNING). This level isn?t intended to be used explicitly, however when a logger has its level set to NOTSET its effective level will be inherited from the parent logger. | |
dict append ::verbosityLevel DEVDBG 5 ;# Way too verbose for regular debugging, but nice to have when someone is getting desperate in a late night debugging session and decides that they want as much instrumentation as possible! :-) |
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
# SOURCE ME | |
# DOES NOT WORK WITH ELEMENTS CONTAINING SPACES!!!! | |
# Limited use. Use a real scriptting language!?!? | |
# Ex: | |
# declare -a cmplxArr='([0]="preffoo" [1]="bar" [2]="foo" [3]="prefbaz" [4]="baz" [5]="prefbar" [6]="pref with spaces" [7]="pref | |
# with | |
# new line" [8]=" | |
# pref with new line before")' | |
NewerOlder