Skip to content

Instantly share code, notes, and snippets.

View gkhays's full-sized avatar

Garve Hays gkhays

View GitHub Profile
@gkhays
gkhays / Git Merge and Diff.md
Last active April 11, 2020 15:37
Git external merge and diff tools

External Merge and Diff Tools

Run four config commands

$ git config --global merge.tool extMerge
$ git config --global mergetool.extMerge.cmd \
  'extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'
$ git config --global mergetool.extMerge.trustExitCode false
$ git config --global diff.external extDiff

Details and Summary Tags in Markdown

Open Me A nice little list.
  • One
  • Two
  • Three
```bash

Simple Shell

Call execv in a C program.

Child Process

int status = execv("/bin/ls", (char *[]) { "ls", "-l", NULL } );

/* If execv returns, something happened. */

If your Internet Protocol (IP) address is something like 192.168.1.x, chances are you are in a private network. RFC 1918 specifies a range of IP addresses for networks that are not directly exposed to the Internet. Typically these types of addresses employ Network Address Translation or NAT to route to the external Internet.

References

Address Allocation for Private Internets (RFC 1918)

@gkhays
gkhays / HWS Info.md
Last active March 5, 2020 17:21
HWS chatbot commands and services reference
@gkhays
gkhays / Empyrion Info.md
Last active March 26, 2020 15:51
Console commands and other helpful information

Empyrion Galactic Survival

Console Commands

  • gm - God mode
  • sbp - Spawn blueprints
  • im - Item menu
  • tt - Teleport
  • map - Show map ('map hide' to reverse)
  • sectors reveal
@gkhays
gkhays / Download File with Node.md
Created February 27, 2020 17:26
Download a file from a URL using Node.js

Download File from URL

Proof-of-concept to download a file from a URL and save it locally. For example, I may wish to retrieve a JAR file from Nexus.

Uses the http package, which does the basics with raw HTTP protocol support.

Possible update: use request, it is like the Python's requests library. There is a companion package called node-request-progress that tracks download progress. See request-progress on GitHub.

Note: The request package has been deprecated.

@gkhays
gkhays / Get JAR Location.md
Created February 15, 2020 14:53
Get the path of a running JAR file

The .toURI() method allows you to sidestep issues with special characters.

return new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation()
    .toURI()).getPath();

References

How to get the path of a running JAR file?

@gkhays
gkhays / Dropwizard Hacks.md
Last active February 14, 2020 16:12
Extend Dropwizard

Out of the Box Things for Dropwizard

Push the boundaries of Dropwizard.

Load Classes on Classpath

The fix for Issue #1314 should load classes on the classpath.

test/resources/example.txt