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
# to generate a new password file- | |
civetweb64.exe -A .htpasswd localhost admin admin | |
# start the server with that password | |
civetweb64.exe -global_auth_file .htpasswd | |
# test in browser, or curl- | |
curl.exe --digest -u mydomain.com\admin:admin http://localhost:8080/somefile.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
import sys | |
if __name__ == "__main__": | |
infile = sys.argv[1] | |
with open(infile, 'r') as f: | |
for line in f: | |
print 'first line: ' | |
print line |
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
gcovr.py -r <rootdir> -f ".*?\.c" -e ".*unittests\.c" -e ".*c_unittester.*\.c" --html --html-details -o summary.html |
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
# program and verify using elf/hex/s19. verify and reset | |
# are optional parameters | |
openocd -f openocd_atsam4s4b_stlink2.cfg -c "program filename.elf verify reset exit" | |
# binary files need the flash address passing | |
openocd -f openocd_atsam4s4b_stlink2.cfg -c "program filename.bin exit 0x08000000" | |
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
# https://docs.python.org/2/howto/logging-cookbook.html#logging-to-multiple-destinations | |
if not None: | |
# set up logging to screen and file | |
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', filename='log.log') | |
# define a Handler which writes INFO messages or higher to the sys.stderr | |
console = logging.StreamHandler() | |
console.setLevel(logging.INFO) | |
# set a format which is simpler for console use | |
formatter = logging.Formatter('%(asctime)s %(message)s') | |
# tell the handler to use this format |
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
''' | |
Scans for serial ports, launches putty (default install path) if you pick | |
one. | |
''' | |
try: | |
from serial.tools import list_ports | |
except: | |
print 'Plz install pyserial, "pip install pyserial"' | |
exit(-1) |
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 itertools | |
import enchant | |
import sys | |
def getwords(letters, len): | |
words = [] | |
d = enchant.Dict("en_US") | |
for w in [''.join(x) for x in itertools.permutations(letters, len)]: | |
if d.check(w): | |
words.append(w) |
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
# NOTE: on ubuntu 20.10, first try `sudo apt install rtl8821ce-dkms`- | |
# you'll need a usb wifi adapter or download the .dpkg and copy over | |
# new instructions | |
# fwiw; newer kernels, ~ > 5.4, seem to work out of the box, possibly | |
git clone https://github.com/tomaspinho/rtl8821ce.git | |
cd rtl8821ce | |
make clean && make -j 6 && sudo make install | |
# reset the driver (if you need to) with this |
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 | |
# Try to yank the JIRA ticket number from the current branch and prefix the commit message with it | |
EXISTING_PREFIX=$(rg -e "[a-zA-Z]+-[0-9]+" $1) | |
if [[ ! -z $EXISTING_PREFIX ]]; then | |
exit | |
fi | |
JIRA_TICKET=$(git symbolic-ref --short HEAD | rg -o -e "[a-zA-Z]+-[0-9]+" | awk '{print toupper($0)": "}') | |
sed -i.bak -e "1s/^/$JIRA_TICKET/" $1 |
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
diff --git a/configure.ac b/configure.ac | |
index 814d8c8..5bc50fa 100644 | |
--- a/configure.ac | |
+++ b/configure.ac | |
@@ -237,6 +237,22 @@ AS_IF( | |
[AC_MSG_ERROR([can not find a parser generator (such as yacc or bison)])])) | |
AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"]) | |
+#---------------------------------------- | |
+# gperf 3.1 generates functions with 'size_t' instead of 'unsigned int' |
OlderNewer