Skip to content

Instantly share code, notes, and snippets.

fenrir fenrir-naru

Block or report user

Report or block fenrir-naru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fenrir-naru
fenrir-naru / check_address.bat
Last active May 8, 2019
Address verifier for emailrelay
View check_address.bat
@C:\path\to\bin\ruby.exe -x "%~f0" %*
@exit /b %ERRORLEVEL%
#!/usr/bin/ruby
# coding: utf-8
address = ARGV[0]
def runner(&b)
if RUBY_PLATFORM =~ /mingw/ then
t = Thread::new{b.call}
@fenrir-naru
fenrir-naru / R_bootstrap.rb
Last active Apr 1, 2019
Windows R deployment script without system wide modification, a.k.a., "portable"
View R_bootstrap.rb
#!/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
View R.input_loop.c
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 Feb 25, 2018 — forked from 1d10t/contacts2.db-to-vcf.php
android contacts2.db to vcard file (vcf) converter
View contacts2.db-to-vcf.php
<?php
ini_set('mbstring.language', 'Japanese');
function db(){
static $db = null;
if(!$db){
$db = new SQLite3(__DIR__.'/contacts2.db');
$db->busyTimeout(60*60*1000);
@fenrir-naru
fenrir-naru / SBAS_rectangle.h
Created Feb 16, 2018
SBAS interpolation of ionospheric grid points
View SBAS_rectangle.h
struct rectangle_t {
/**
* igp[2] -- igp[3] igp[0] -- igp[1]
* | | in north, | | in south
* igp[0] -- igp[1] igp[2] -- igp[3]
*
* assumption
* igp[0].lat = igp[1].lat, igp[2].lat = igp[3].lat
* igp[0].lng < igp[1].lng, igp[2].lng < igp[3].lng
*/
View MatrixView2.cpp
#include <iostream>
using namespace std;
struct MatrixView;
template <class BaseView>
struct MatrixViewTranspose;
template <class BaseView>
View MatrixView.cpp
#include <iostream>
using namespace std;
template <class T>
struct A;
template <class T, bool is_transposed, bool is_partial>
struct A_View : public A<T> {
struct {
@fenrir-naru
fenrir-naru / f477.c
Last active Sep 26, 2017
EGM96 Geoid Fortran to C
View f477.c
void main(){
double AR = AE / RE,
ARN = AR,
AC = 0.0,
A = 0.0,
B = 0.0;
int K = 3;
for(int N = 2; N <= NMAX; N++){ // DO 030 N=2,NMAX
ARN *= AR;
K++;
@fenrir-naru
fenrir-naru / gist:95669cb8fcbf14c22e59
Last active Sep 21, 2017
How to install max310x driver for RasPi 3.12.26+
View gist:95669cb8fcbf14c22e59
# modify Kconfig to change to tristate
# make driver
sudo make prepare
sudo make modules_prepare KERNELRELEASE=$(uname -r)
sudo make SUBDIRS=drivers/tty/serial modules
sudo make SUBDIRS=drivers/tty/serial modules_install
sudo mv /lib/modules/3.12.26/extra/* /lib/modules/3.12.26+/extra/
sudo rm -r /lib/modules/3.12.26
sudo depmod
@fenrir-naru
fenrir-naru / rb-gsl.install.sh
Last active Jul 28, 2017
rb-gsl intall without gem command
View rb-gsl.install.sh
gem install bundler
# gem env | grep "EXECUTABLE DIRECTORY" の結果を受けて
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
git clone --depth 1 https://github.com/SciRuby/rb-gsl.git
cd rb-gsl
bundler install
# ソースコードの修正、例えば
patch -p0 << __PATCH_LINE__
--- ext/gsl_native/sf_legendre.c.orig 2017-07-28 23:28:56.944690200 +0900
+++ ext/gsl_native/sf_legendre.c 2017-07-28 23:44:56.284917800 +0900
You can’t perform that action at this time.