Skip to content

Instantly share code, notes, and snippets.

View gojimmypi's full-sized avatar

gojimmypi gojimmypi

View GitHub Profile
@gojimmypi
gojimmypi / dos_timestamp.bat
Created July 18, 2017 23:29
DOS environment variable formatted date-time as YYMMDD_HHMMSS
:: set the FileStamp variable to the current date: YYMMDD_HHMMSS
:: the simplest method, to use existing TIME ad DATE variables:
:: date = Thu 09/17/2015
:: time = 11:13:15.47
:: 012345678901234567890
::
:: There is no leading zero for single digit hours (e.g. 9:00am), so we need to manually include the zero
:: here |
if "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~4,2%%DATE:~7,2%_0%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%
@gojimmypi
gojimmypi / Install_ESP32.bat
Created December 21, 2017 05:08
M5stack ESP32 Arduino IDE install
:: Arduino IDE 1.8.5
:: see https://learn.sparkfun.com/tutorials/esp32-thing-hookup-guide#installing-the-esp32-arduino-core
:: run as administrator
cd "C:\Program Files (x86)\Arduino\hardware"
mkdir espressif
cd espressif
git clone https://github.com/espressif/arduino-esp32.git esp32
:: run get.exe
@gojimmypi
gojimmypi / add_cmd_prompt.reg
Created March 3, 2018 09:03
“Open with Command Prompt” when shift-right clicking in Explorer
Windows Registry Editor Version 5.00
; see https://superuser.com/questions/1201988/how-do-i-change-open-with-powershell-to-open-with-command-prompt-when-shift
; Command Prompt
[HKEY_CLASSES_ROOT\Directory\shell\01MenuCmd]
"MUIVerb"="Command Prompts"
"Icon"="cmd.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MenuCmd"
@gojimmypi
gojimmypi / git-delete.sh
Created June 22, 2018 23:50
Delete a git file
#!/bin/bash
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_TO_DELETE.TXT' --prune-empty --tag-name-filter cat -- --all
# see https://stackoverflow.com/questions/2004024/how-to-permanently-delete-a-file-stored-in-git
#
# "This command will run the entire history of every branch and tag, changing any commit that involved the file,
# and any commits afterwards. Commits that are empty afterwards (because they only changed the Rakefile) are removed entirely."
sudo iwlist wlan0
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
add:
network={
ssid="testing"
psk="testingPassword"
}
@gojimmypi
gojimmypi / RPi-Upgrade
Last active July 2, 2018 21:27
Raspberry Pi Upgrade from wheezy to jessie to stretch
# In-place upghrade from wheezy to jessie
# https://raspberrypi.stackexchange.com/questions/27858/upgrade-to-raspbian-jessie
# https://raspberrypi.stackexchange.com/questions/80029/how-to-complete-upgrade-from-wheezy-to-stretch
# Backup any files which are important to you.
# Ensure there is plenty of disk space free df -h
# With your new or existing install:
sudo apt-get update
@gojimmypi
gojimmypi / search_all_tables.sql
Created September 7, 2018 17:24
Search all SQL tables for a specific value (useful for reverse engineering to find where data is stored in a database)
-- this stored proc will generate a list of SELECT statements to show the rows of all tables containing search results.
-- by gojimmypi
CREATE PROCEDURE dbo.proc_SEARCH_ALL_TABLES
@search_string as varchar(255), -- use exact text or SQL wildcards (e.g. '%XYZZY%')
@min_length as int = 0, -- give hints for performance, such as the minimum field size to search, or
@search_numeric as char(1) = 'N', -- could the data be in a numeric field?
@search_text as char(1) = 'Y', -- or perhaps the data could be in a text field?
@echo_output as varchar(8) = Null,
@debug_status as varchar(8) = Null
AS
@gojimmypi
gojimmypi / esp32_promisc.c
Created May 31, 2017 23:57 — forked from brainstorm/esp32_promisc.c
esp32 promiscuous mode and packet injection experiments
// Espressif ESP32 promiscuous mode and packet injection experiments
// by brainstorm at nopcode org
#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "lwip/err.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
@gojimmypi
gojimmypi / install_icestorm.sh
Last active December 14, 2018 22:03
icestorm FPGA install
#!/bin/bash
sudo apt-get update
sudo apt-get install build-essential clang bison flex libreadline-dev \
gawk tcl-dev libffi-dev git mercurial graphviz \
xdot pkg-config python python3 libftdi-dev
# RPi supplments needed:
@gojimmypi
gojimmypi / wsl_lsusb_strace_output.txt
Created December 31, 2018 12:52
wsl: strace -o lsusb.strace -f lsusb
327 execve("/usr/bin/lsusb", ["lsusb"], [/* 19 vars */]) = 0
327 brk(NULL) = 0x13ba000
327 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
327 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
327 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
327 fstat(3, {st_mode=S_IFREG|0644, st_size=45228, ...}) = 0
327 mmap(NULL, 45228, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fed18fa8000
327 close(3) = 0
327 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
327 open("/lib/x86_64-linux-gnu/libusb-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3