Skip to content

Instantly share code, notes, and snippets.

@jbaranski
jbaranski / OracleOpenPort80Centos.md
Created Sep 26, 2020
Open Port 80 Oracle Cloud Compute Instance (CentOS)
View OracleOpenPort80Centos.md

Open Port 80 Oracle Cloud Compute Instance (CentOS)

FYI This was harder than it needed to be:

  1. Looking at your instance info, find VNIC section, click "Public Subnet".
  2. Click on your security list.
  3. Add a new entry with the following options:
  • "Stateless" = No, "Source" = 0.0.0.0/0, "IP Protocol" = TCP, "Source Port Range" = All, "Destination Port Range" = 80
  1. SSH to your instance.
  2. While SSH'ed in your instance, run command firewall-cmd --permanent --add-service=http.
  3. While SSH'ed in your instance, run command firewall-cmd --reload.
  4. Now start Apache, NGINX, or whatever server you need to on port 80. You can now access from the internet.
@jbaranski
jbaranski / CentOS.md
Last active Sep 19, 2020
New CentOS 8 Server
View CentOS.md

This post is an evolving draft...

Initial setup (less verbose version of this article)

# Run updates
yum update
yum install nano
# Change root password
passwd root
@jbaranski
jbaranski / StartIDEA.md
Last active Aug 6, 2020
Intellij IDEA won't start on Windows 10 for some reason
View StartIDEA.md

For some reason Intellij IDEA won't start on Windows 10 when you double click the shortcut / exe icon.

To start...

cd "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2\bin"

idea.bat

It will start. The terminal is also really buggy, won't register keystrokes > 90% of the time.

@jbaranski
jbaranski / Img2MBTilesWithGDAL.md
Created Aug 1, 2020
Convert an image (like JPG or TIF) to MBTiles using GDAL
View Img2MBTilesWithGDAL.md

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 / SelfHostOpenStreetMapDocker.md
Created Aug 1, 2020
How to self host an Open Street Map server (using Docker)
View SelfHostOpenStreetMapDocker.md

Here are the steps needed to run a self hosted Open Street Map server (using Docker):

  1. Download desired pbf files (like south-carolina-latest.osm.pbf) from https://download.geofabrik.de or just use the following empty planet below:

    
      <?xml version='1.0' encoding='UTF-8'?>
      <osm version="0.6" generator="osmconvert 0.8.8" timestamp="2019-10-23T20:18:02Z">
        <bounds minlat="42.4276" minlon="1.412368" maxlat="42.65717" maxlon="1.787481"/>
      </osm>
    
@jbaranski
jbaranski / GradleTaskAlias.md
Created Aug 1, 2020
Alias a task name in Gradle
View GradleTaskAlias.md

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'
            }
View NodeJSLocalModule.md

The following package.json snippet is how to reference a local module in your Node.js project:

package.json

{
  ...
  "dependencies": {
    "local-module": "file:./local-module",
    ...
  }
@jbaranski
jbaranski / ReadYamlAndJson.md
Created Aug 1, 2020
Read in YAML or JSON file using Python
View ReadYamlAndJson.md

The following code will read in a YAML file and store it in a dictionary. The dictionary content is then printed to the console.

config.yaml

test: value
nested:
  test: nestedValue

@jbaranski
jbaranski / SSHSpecificPrivateKey.md
Created Aug 1, 2020
SSH Use Specific Private Key
View SSHSpecificPrivateKey.md

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 / LiquibaseCompositePrimaryKey.md
Created Aug 1, 2020
Liquibase Composite Primary Key
View LiquibaseCompositePrimaryKey.md

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>
      </column>
You can’t perform that action at this time.