Skip to content

Instantly share code, notes, and snippets.

@jbaranski
jbaranski / SSHSpecificPrivateKey.md
Created August 1, 2020 14:44
SSH Use Specific Private Key

If you have multiple SSH keys generated for different purposes (one for GitHub, one for server administration, etc...) you can specify which private key to use via config.

In ~/.ssh/config you may have the following:

host github.com
 HostName github.com
 IdentityFile ~/.ssh/id_rsa.github
 User <your PC user name (not GitHub user name)>
@jbaranski
jbaranski / oracledb.py
Created September 4, 2016 20:01
Python Oracle DB connection wrapper
"""
Oracle database connection wrapper
@author: jbaranski
"""
import cx_Oracle
class OracleDB:
"""
Usage:
@jbaranski
jbaranski / LiquibaseCompositePrimaryKey.md
Created August 1, 2020 14:43
Liquibase Composite Primary Key

Here are two examples of how to define a composite primary key for some table using Liquibase.

  • Add the composite primary key up front during table construction (preferred).
  <changeSet id="1">
    <createTable tableName="some_table">
      <column name="id_1" type="varchar_ignorecase">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOME_TABLE"></constraints>
 
@jbaranski
jbaranski / GradleTaskAlias.md
Created August 1, 2020 14:49
Alias a task name in Gradle

The following snippet is how to alias a task name in Gradle:

build.gradle

    // You can now run "gradle alias" and it would be equivalent to running "gradle taskToAlias"
    task alias {
        dependsOn allprojects.collect { proj ->
            proj.tasks.matching {
                it.name == 'taskToAlias'
 }
@jbaranski
jbaranski / nexus_upload.sh
Last active November 9, 2022 09:36
Artifact upload to nexus using curl
# nexus 2.x
# Assuming you run this command against the directory the jar sits in
#
# r - repository
# hasPom - whether you are supplying the pom or you want one generated. If generated g, a, v, p, and c are not needed
# e - extension
# g - group id
# a - artifact id
# v - version
# p - packaging
@jbaranski
jbaranski / shell.sh
Last active September 10, 2023 14:45
How to fix: "chromedriver" can’t be opened because Apple cannot check it for malicious software.
# How to fix: "chromedriver" can’t be opened because Apple cannot check it for malicious software.
xattr -d com.apple.quarantine /opt/homebrew/bin/chromedriver
@jbaranski
jbaranski / shell.sh
Last active September 29, 2024 19:40
MacBook increase display brightness on the command line
# Increase display brightness command
osascript -e 'tell application "System Events"' -e 'key code 144' -e ' end tell'
# Decrease display brightness command
osascript -e 'tell application "System Events"' -e 'key code 145' -e ' end tell'
# zsh solution to turn it all the way up on one command, just run `b` on the cmd line
alias bright="osascript -e 'tell application \"System Events\"' -e 'key code 144' -e ' end tell'"
alias b="repeat 10 { bright }"
@jbaranski
jbaranski / db.json
Last active December 28, 2024 00:51
Open Trivia DB data dump (opentdb.com)
This file has been truncated, but you can view the full file.
[
{
"type": "multiple",
"difficulty": "medium",
"category": "Entertainment: Video Games",
"question": "What is the world&#039;s first video game console?",
"correct_answer": "Magnavox Odyssey",
"incorrect_answers": [
"Coleco Telstar",
"Nintendo Color TV Game",
@jbaranski
jbaranski / Img2MBTilesWithGDAL.md
Created August 1, 2020 14:52
Convert an image (like JPG or TIF) to MBTiles using GDAL

Here are the steps needed to convert an image (like JPG or TIF) to MBTiles using GDAL:

  1. Download and install GDAL (https://gdal.org/, https://anaconda.org/conda-forge/gdal):

       conda install -c conda-forge gdal
    

    Installing GDAL is kind of a pain in the ass, especially on Windows. I'm assuming you'll be able to work out whatever issues you run into here.

  2. Download example jpg and tif map images we can work with:

@jbaranski
jbaranski / ffmpeg_mac_m1_record_cmd_line.md
Last active March 11, 2025 04:02
ffmpeg record screen on Mac M1 chip via command line

ffmpeg record screen on Mac M1 chip via command line

  1. Install ffmpeg.

brew install ffmpeg

  1. Figure out which device to use.

ffmpeg -f avfoundation -list_devices true -i ""

Ouput will look like: