Skip to content

Instantly share code, notes, and snippets.

View daryltucker's full-sized avatar

Daryl Tucker daryltucker

  • Neo-Retro Group
  • Salem, Or
View GitHub Profile
@daryltucker
daryltucker / recv_all.py
Created November 21, 2014 22:04
Receive all data in socket buffer (python)
import socket
import ssl
'''
Receive all data in socket buffer, while preventing locking/blocking.
'''
sockx = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock = ssl.wrap_socket(sockx)
@daryltucker
daryltucker / hevrist
Created August 19, 2022 21:42
Find directories with lots of data within them.
#!bin/bash
function hevrist(){
local MAX=3;
local n=0;
QUERY=$1;
function h_x(){
du -shx $1/* 2>/dev/null | sort -rh | head -n 10;
};
while [ -n ${n} ] && [ ${n} -lt ${MAX} ]; do
@daryltucker
daryltucker / curl_azure_chunk_upload.sh
Last active December 15, 2023 23:19
Chunk Upload to Azure Storage with curl
#!/bin/bash
# AZ_SAS_TOKEN=''
# ArtifactLocation=''
# ArtifactBaseName=''
DATE_NOW=$(date -Ru | sed 's/\\+0000/GMT/')
AZ_VERSION="2022-11-02"
AZ_BLOB_URL="https://STORAGE_ACCOUNT_HERE.blob.core.windows.net"
AZ_BLOB_CONTAINER="${ApplicationName}"
AZ_BLOB_TARGET="${AZ_BLOB_URL}/${AZ_BLOB_CONTAINER}/"
@daryltucker
daryltucker / kibana-node-upgrade.sh
Last active November 22, 2023 04:03
Upgrade Node for Kibana
#!/bin/bash
NODE_VERSION=v18.18.2
cd /tmp/
wget --no-clobber https://nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz
sudo systemctl stop kibana
tar -xvf node-${NODE_VERSION}-linux-x64.tar.xz --strip-components=1 \
--overwrite \
--directory /usr/share/kibana/node/
cat <<EOF | tee /tmp/node_version_validator.js.patch
@daryltucker
daryltucker / flask.py
Last active October 12, 2023 13:31
Really disable logger logging in Flask
# I have my own logging setup and had a hard time disabling console output in Flask.
app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disabled = True
# New, 2022 Method:
logging.getLogger('werkzeug').disabled = True
@daryltucker
daryltucker / certbot-dns-linode_v4.mkd
Created October 6, 2023 19:20
certbot-dns-linode

[{u'ERRORCODE': 16, u'ERRORMESSAGE': u'Linode API v3 is no longer active. Please use Linode API v4: https://www.linode.com/docs/api'}]

Make sure you're on Debian 11+ vs Debian 10-

@daryltucker
daryltucker / pem-to-pkcs12-with-intermediates.sh
Created August 24, 2023 17:42
Create PKCS12 from PEM (Certbot)
openssl pkcs12 -export -out example.net.p12 -inkey /etc/letsencrypt/live/example.net/privkey.pem -in /etc/letsencrypt/live/example.net/cert.pem -certfile /etc/letsencrypt/live/example.net/chain.pem -name example.net
@daryltucker
daryltucker / dmesg_restrict.mkd
Created December 31, 2019 18:14
Allow non-root User to access syslog/dmesg
$ dmesg
dmesg: read kernel buffer failed: Operation not permitted
$ sudo sysctl -w kernel.dmesg_restrict=0
$ dmesg
@daryltucker
daryltucker / Windows11_Program_Startup.mkd
Created September 7, 2022 20:14
Windows 11 Startup Application named "Program"

While investigating Startup Applications, I noticed one named "Program". Using Task Manager, I was able to add "Command line" column under the Startup tab. This showed me which application was being started. In my case, it was WinHotKey. Also, "Startup type" column, to expose where the startup configuration lives (ie: Registry).

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

Place double quotes around the value. For example:

"C:\Program Files (x86)\WinHotKey\WinHotKey.exe"
@daryltucker
daryltucker / README.mkd
Last active August 26, 2022 20:55
Commit Message Hooks for Various Ticketing Systems

Goal

  1. Isolate different git configurations by like-workflows
  2. Automatically associate work tasks to commits.

Example

git checkout features/1234-banana
touch banana; git add banana