Skip to content

Instantly share code, notes, and snippets.

View robcowie's full-sized avatar

Rob Cowie robcowie

  • Recycleye
  • Leeds/London, United Kingdom
View GitHub Profile
@robcowie
robcowie / delete_table_from_metastore.sql
Last active February 28, 2024 20:19
Drop a table form the hive metastore
# DELETE A TABLE IN THE HIVE METASTORE
# BE CAREFUL! BACKUP THE DB BEFORE PROCEEDING!
set @table_name = '';
SELECT @tbl_id := TBl_ID FROM TBLS WHERE TBL_NAME = @table_name;
-- Delete partition key vals
DELETE pvk
FROM PARTITION_KEY_VALS pvk
@robcowie
robcowie / mysqldb_query_generator.py
Created February 7, 2011 16:05
Memory-efficient, streaming query generator with MySQLdb
from MySQLdb.cursors import SSDictCursor
def iterate_query(query, connection, arraysize=1):
c = connection.cursor(cursorclass=SSDictCursor)
c.execute(query)
while True:
nextrows = c.fetchmany(arraysize)
if not nextrows:
break
@robcowie
robcowie / gh_dependabot.sh
Last active December 20, 2023 10:30
gh cli commands to work with Dependabot PRs
# Github CLI commands to work with dependabot PRs
# List dependabot PRs that need review
gh pr list -l dependencies --search "status:success review:none"
gh pr list -A app/dependabot --search "status:success review:none"
# Instruct dependabot to merge all reviewed PRs, oldest first
gh pr list \
-A app/dependabot \
--search "status:success review:approved" \
@robcowie
robcowie / README.md
Last active December 5, 2023 12:15
Create IoT Edge device certificates

Devvice Certificate Creation

Problems with OpenSSL 3.2.0

Creation of the CA certificate signing request fails with the follwing error

80A027F501000000:error:11000079:X509 V3 routines:v2i_AUTHORITY_KEYID:no issuer certificate:crypto/x509/v3_akid.c:156:
80A027F501000000:error:11000080:X509 V3 routines:X509V3_EXT_nconf_int:error in extension:crypto/x509/v3_conf.c:48:section=v3_intermediate_ca, name=authorityKeyIdentifier, value=keyid:always,issuer:always
@robcowie
robcowie / Preferences.sublime-settings
Created March 16, 2012 12:36
Example Sublimetext 2 TODO plugin config
{
"color_scheme": "Packages/User/textmate-solarized/Solarized (Dark).tmTheme",
"default_line_ending": "unix",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "selection",
"find_selected_text": true,
"font_face": "menlo",
"font_size": 12,
"highlight_line": true,
@robcowie
robcowie / usa_sic_codes.sql
Created July 16, 2010 19:04
US SIC Codes, sql table definition and data
CREATE TABLE `sic_code` (
`code` varchar(32) NOT NULL DEFAULT '',
`label` varchar(256) DEFAULT NULL,
`parent_code` varchar(32) DEFAULT NULL,
`level` int(11) DEFAULT NULL
) DEFAULT CHARSET=utf8;
INSERT INTO `sic_code` (`code`,`label`,`parent_code`,`level`)
VALUES
('D','MANUFACTURING',NULL,0),
@robcowie
robcowie / install.sh
Created July 19, 2023 11:38
Coming Gstreamer in Nvidia l4t Deepstream 6.2 Container (non-functional)
cd ~
# Copy nv* gstreamer elements
mkdir nvgst
cp /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnv* ./nvgst/
# Dependency dir
mkdir -p /build
# Upgrade packages and install missing dependencies
@robcowie
robcowie / rabbitmq_conf_homebrew
Created October 26, 2011 19:48
Location of rabbitmq config files with homebrew
Rabbitmq conf locations for homebrew
/usr/local/etc/rabbitmq/rabbitmq-env.conf
/usr/local/etc/rabbitmq/rabbitmq
@robcowie
robcowie / gstreamer_examples.md
Last active June 16, 2023 19:27
Gstreamer Pipeline Examples

Gstreamer Examples

Videotest Source

gst-launch-1.0 -e videotestsrc pattern=ball num-buffers=300 \
! video/x-raw,width=640,height=480,framerate=30/1 \
! nvvideoconvert \
! nvv4l2h265enc \
! mp4mux \
@robcowie
robcowie / .mpdconf
Last active June 8, 2023 16:12
Install mpd on OSX 10.8
## ~/.mdpconf
port "6600"
music_directory "~/Music/"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/state"
#bind_to_address "~/.mpd/mpd.sock"