Skip to content

Instantly share code, notes, and snippets.

View chrishuan9's full-sized avatar
🎯
Focusing

Chris Huang chrishuan9

🎯
Focusing
  • Basel, Switzerland
View GitHub Profile
@chrishuan9
chrishuan9 / brew-upgrade-casks.md
Created December 3, 2022 23:59
brew - upgrade casks
for cask in $(brew list --cask); do brew upgrade --cask $cask; done;
# command autocompletion
autoload -U compinit; compinit
# +----+
# | ls |
# +----+
alias ls='ls -G'
alias lsl='ls -l'
alias ll='ls -lahF'
@chrishuan9
chrishuan9 / brew-install-script.sh
Created March 14, 2022 16:06 — forked from julian-wendt/brew-install-script.sh
Brew script for installing packages and applications on OSX
#!/bin/sh
# Homebrew Script for OSX
# To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh`
echo "Installing brew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing brew cask..."
brew tap homebrew/cask

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@chrishuan9
chrishuan9 / remove_mcafee.md
Created January 6, 2020 04:49 — forked from pjobson/remove_mcafee.md
OSX McAfee Removal

Removal of McAfee from OSX

Note: This was written in 2015, it may be out of date now.

There are a lot of commands here which I use sudo if you don't know what you're doing with sudo, especially where I rm you can severely screw up your system.

There are many reasons which you would want to remove a piece of software such as McAfee, such as not wanting it to hammer your CPU during work hours which seems like primetime for a virus scan.

I intend this to be a living document, I have included suggestions from peoples' replies.

@chrishuan9
chrishuan9 / DatabaseExtract-Incremental.xml
Created March 5, 2019 08:46
ETL Database Extraction with Apache NiFi Process Workflow
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><template><description>Simple flow for extracting records from a relational database and into JSON text files.</description><name>DatabaseExtract-Incremental</name><snippet><connections><id>5f3f82ab-fc02-4322-938c-ad2fb628f094</id><parentGroupId>0ef63979-973e-43fc-82b2-a5cd52db0858</parentGroupId><backPressureDataSizeThreshold>0 MB</backPressureDataSizeThreshold><backPressureObjectThreshold>0</backPressureObjectThreshold><destination><groupId>0ef63979-973e-43fc-82b2-a5cd52db0858</groupId><id>bb5fadae-29d0-4983-b76d-4185a5003685</id><type>PROCESSOR</type></destination><flowFileExpiration>0 sec</flowFileExpiration><labelIndex>1</labelIndex><name></name><selectedRelationships>merged</selectedRelationships><source><groupId>0ef63979-973e-43fc-82b2-a5cd52db0858</groupId><id>08cf9faa-f1cd-4e94-b3bd-ff6366973fbb</id><type>PROCESSOR</type></source><zIndex>0</zIndex></connections><connections><id>40e2bddf-ac38-4261-b64c-07571f77b8fd</id><parentGroupId>0ef63979-973e
import asyncio, asyncssh, sys
async def run_client():
#async with asyncssh.connect('localhost',kex_algs=["diffie-hellman-group1-sha1"],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn:
async with asyncssh.connect('10.28.8.1',kex_algs=['diffie-hellman-group-exchange-sha256','diffie-hellman-group-exchange-sha1','diffie-hellman-group1-sha1','diffie-hellman-group14-sha1','diffie-hellman-group14-sha256','diffie-hellman-group15-sha512','diffie-hellman-group16-sha512','diffie-hellman-group17-sha512','diffie-hellman-group18-sha512'],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn:
result = await conn.run('ls', check=True)
print(result.stdout, end='')
def main():
try:
@chrishuan9
chrishuan9 / excel_hex2dec_float.vba
Created November 29, 2018 06:59
VBA Makro for converting a hex number to decimal float
Function HEX2DECFL(strHexVal As String) As Double
'
' Function to convert 4 byte (32 bit) Hex value
' to a floating point decimal number
' using IEE 754
'
' Dave Stow
'
' Lookup array of hex digits to binary digits
Dim strBinaryDigits() As Variant
@chrishuan9
chrishuan9 / excel_hex_string_reverse.vba
Created November 29, 2018 06:54
Hex String Big to Little Endian in Excel
' VBA function which changes big to little endian
' reverses 1 byte (2 hex number pair)
' e.g changes 480000074B26E42D to 2DE4264B07000048
'
Public Function strReverse_Character_Pairs(ByVal strValue As String) As String
Dim lngLoop As Long
Dim strReturn As String
strReturn = ""