Skip to content

Instantly share code, notes, and snippets.

@fenrir-naru
fenrir-naru / landisk-shutdown.rb
Last active July 23, 2024 15:19
HDL-AAX shutdown script
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
# 設定内容
url = "http://192.168.1.XXX" # TODO
password = "password" # TODO
module Kernel # required for version below 2.6
def then
return to_enum(__method__) { 1 } unless block_given?
@fenrir-naru
fenrir-naru / dow_spec.rb
Last active July 4, 2024 16:21
weekday C function for 8bit MCU
require 'rspec'
require 'inline'
require 'date'
module Date_C
inline{|builder|
builder.add_type_converter('unsigned char', 'NUM2CHR', 'CHR2FIX')
builder.include("<time.h>") #builder.prefix("#include <time.h>")
builder.c_singleton(open(File::join(File::dirname(__FILE__), 'dow_time_h.c')).read)
builder.c_singleton(open(File::join(File::dirname(__FILE__), 'dow_u8.c')).read)

How to use this program to estimate relative position between two near GNSS antennas

  1. Install Ruby
    • For Windows users, RubyInstaller is convinient, and please select "WITH DEVKIT" version because of native compilation required by a dependent gem.
  2. Install gps_pvt gem: gem install gps_pvt
  3. Download est_proximity.rb
  4. Type the following on the directory in which est_proximity.rb and observation files are stored: ./est_proximity.rb base_obs_file aux_obs_file1 [aux_obs_file2] ... [options] ...
    • The supported formats of the observation files are u-blox(UBX), RINEX OBS(v2/v3). COM port and Ntrip stream can be used. The details are described in gps_pvt readme.
  • --onl
@fenrir-naru
fenrir-naru / ambiguity_test.rb
Last active October 25, 2022 02:14
Attitude estimation code 2022/10/25
#!/usr/bin/ruby
require 'gps_pvt'
LAMBDA = GPS_PVT::GPS::SpaceNode.L1_WaveLength
Mat = GPS_PVT::SylphideMath::MatrixD
candidates = [-1, 0, 1]
run = proc{
prop = {}
@fenrir-naru
fenrir-naru / Outlook.vbs
Last active May 13, 2021 23:54
Outlook desktop to Google calendar
Public WithEvents myOlFolder As Outlook.Folder
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()
Set myOlFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar)
Set myOlItems = myOlFolder.Items
End Sub
Private Sub sendREST(ByVal Item As Object, ByVal Mode As String)
Dim params As Object
@fenrir-naru
fenrir-naru / BoostDistributions.i
Last active September 17, 2020 00:00
SWIG for boost::math::distributions
/**
* @file SWIG interface file for boost::math::distributions
*
*/
%module BoostDistributions
%include exception.i
%exception {
try {
@fenrir-naru
fenrir-naru / EFS%nv%item_files%mcfg%mcfg_sel_db.xml
Last active March 13, 2020 00:38
Mi 9 SE with AU(KDDI) CDMA
<?xml version="1.0" encoding="UTF-8"?>
<policy mcfg_db_ver="1.2.3" name="generic">
<initial>
<tristate_define name="iin" value="undef" />
<tristate_define name="3gpp_imsi" value="undef" />
<tristate_define name="3gpp2_imsi" value="undef" />
</initial>
<if>
<any_of evaluate_all="true">
<tristate_reset_all return="false" />
@fenrir-naru
fenrir-naru / R_bootstrap.rb
Last active April 1, 2019 05:08
Windows R deployment script without system wide modification, a.k.a., "portable"
#!/usr/bin/ruby
class R_Bootstrap
class <<self
def registry_check(ver = nil)
[:HKLM, :HKCU].collect{|head|
`reg query "#{head}\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" /f "R for Windows*is1" 2>nul`.scrub.lines
}.flatten.collect{|line|
next unless line.strip =~ /^\s*(.*#{ver}_is1)/
$1
int attribute_hidden
Rstd_ReadConsole(const char *prompt, unsigned char *buf, int len,
int addtohistory)
{
if(!R_Interactive) {
#if 0
size_t ll;
int err = 0;
if (!R_Slave) {
fputs(prompt, stdout);
@fenrir-naru
fenrir-naru / contacts2.db-to-vcf.php
Last active February 20, 2021 23:54 — forked from 1d10t/contacts2.db-to-vcf.php
android contacts2.db to vcard file (vcf) converter
<?php
ini_set('mbstring.language', 'Japanese');
function db(){
static $db = null;
if(!$db){
$db = new SQLite3(__DIR__.'/contacts2.db');
$db->busyTimeout(60*60*1000);