Skip to content

Instantly share code, notes, and snippets.

View jhmt's full-sized avatar

Jun Hashimoto jhmt

  • Auckland, New Zealand
View GitHub Profile
@jhmt
jhmt / jq_test.sh
Created March 3, 2023 19:46
Pass parameter to a jq query in a shell script file.
#!/bin/bash
url="https://my.sample.com/5678"
objName=$(cat sample.json|jq --arg URL "$url" '[.[]|select(.owner.owner_url==$URL)][0]'|jq '.name')
echo $objName
@jhmt
jhmt / Vincenty.cs
Created June 14, 2020 06:42
C# implementation of Vincenty's formula direct problem
using System;
namespace Vincenty
{
public class Vincenty
{
private double RadiusLong = 6378137.0;
private double Flatts = 1 / 298.257222101;
private double RadiusShort => RadiusLong * (1 - Flatts);
<html>
<head>
<title>Code Kata Session 26/05/16</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js" ></script>
<script type="text/javascript">
$(function(){
$('input').change(function(){
var changed = this;
$(this).siblings().map(function(index, input){
input.checked = ((input.value % changed.value) === 0)? changed.checked : input.checked;