Skip to content

Instantly share code, notes, and snippets.

View gahrae's full-sized avatar

Gareth gahrae

  • Newmarket, NH, USA
View GitHub Profile
-- Purpose: Debug a single Java class from within LazyVim
-- Overview of steps:
-- 1. Update ~/.config/nvim/lua/config/lazy.lua to enable the 'Java Extra'
-- 2. Add new plugin config at ~/.config/nvim/plugins/debug_java.lua
-- 3. Test: Add break point, hit <leader>dA, Observe debugging in action.
-- Notes:
-- 1. Works for a single Java file, larger projects likely will need other steps or configuration
-- 2. Solution was found on Reddit, see reference 1.
-- References:
-- 1) Reddit: https://www.reddit.com/r/neovim/comments/subfv1/help_setting_up_debugger_for_java/
@gahrae
gahrae / telekasten.lua
Created December 10, 2023 01:35
LazyVim 'plugin configuration file' for Telekasten with extra functions to yank a link to a specific heading, line, or with a description.
-- Purpose:
-- 1. Demonstrate configuring Telekasten with LazyVim 'plugin configuration' file.
-- 2. Add ability to create links to ...
-- - a heading under the cursor
-- - a specific line under the cursor (using a 'block reference')
-- - the file with a description entered at a prompt
-- 3. Demonstrate having a main vault and seperate one(s) for work
-- Usage: (look for 'TODO')
-- 1. Save as ~/.config/nvim/plugins/telekasten.lua
-- 2. Create directories for vault(s)
@gahrae
gahrae / silent-night-omega2.py
Created July 25, 2020 22:14 — forked from root42/silent-night-omega2.py
Plays "silent night" on a piezo buzzer attached to pin 18 of the Onion Omega2
#!/usr/bin/env python
# Plays "silent night" on a piezo buzzer attached to pin 18 of the Onion Omega2
# Things required: python lite, pwm needs to be enabled via:
# omega2-ctrl gpiomux set pwm0 pwm
from time import sleep
exportStr="/sys/class/pwm/pwmchip0/export"
periodStr="/sys/class/pwm/pwmchip0/pwm%s/period"
dutyStr="/sys/class/pwm/pwmchip0/pwm%s/duty_cycle"
@gahrae
gahrae / Example.java
Last active August 4, 2018 07:20
Demonstrate using EasyMock to mock a method argument modification.
import org.easymock.EasyMock;
import org.easymock.IAnswer;
import org.junit.Assert;
import org.junit.Test;
/*
* Demonstrate using EasyMock to mock a method argument modification.
*/
// Dependency to mock...
@gahrae
gahrae / decodeFloat.js
Created December 18, 2015 15:35 — forked from kg/decodeFloat.js
Decode 32/64-bit float from bytes in JavaScript
// Derived from http://stackoverflow.com/a/8545403/106786
function decodeFloat(bytes, signBits, exponentBits, fractionBits, eMin, eMax, littleEndian) {
var totalBits = (signBits + exponentBits + fractionBits);
var binary = "";
for (var i = 0, l = bytes.length; i < l; i++) {
var bits = bytes[i].toString(2);
while (bits.length < 8)
bits = "0" + bits;
@gahrae
gahrae / Int64.js
Created December 17, 2015 20:24 — forked from lttlrck/Int64.js
64-bit Integer type for Javascript based on Int64.js but NodeJS dependency on buffer removed, plus some other small mods.
// Int64.js
//
// Copyright (c) 2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
/**
* Support for handling 64-bit int numbers in Javascript (node.js)
*
* JS Numbers are IEEE-754 binary double-precision floats, which limits the
* range of values that can be represented with integer precision to: