Skip to content

Instantly share code, notes, and snippets.

View ompugao's full-sized avatar

ompugao

View GitHub Profile
@ompugao
ompugao / linux_magic.cpp
Created August 15, 2020 15:30 — forked from xymopen/linux_magic.cpp
C++ equivalences of the famous offset_of and container_of(owner_of) macro from Linux kernel
template< class T, class M >
static inline constexpr ptrdiff_t offset_of( const M T::*member ) {
return reinterpret_cast< ptrdiff_t >( &( reinterpret_cast< T* >( 0 )->*member ) );
}
template< class T, class M >
static inline constexpr T* owner_of( M *ptr, const M T::*member ) {
return reinterpret_cast< T* >( reinterpret_cast< intptr_t >( ptr ) - offset_of( member ) );
}
# -*- coding: utf-8 -*-
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import cv2
from shapely.geometry import Point, LineString
import weakref
import time
np.set_printoptions(edgeitems=30, linewidth=100000, formatter=dict(float=lambda x: "%.3g" % x))
@ompugao
ompugao / md_nav.vim
Last active June 24, 2020 00:43
markdown navigation in vim
function! s:jump() abort
let [l_from, c_from] = searchpairpos('\[\[', '', '\]\]', 'nbW')
if l_from == 0 || c_from == 0
return
endif
let [l_to, c_to] = searchpairpos('\[\[', '', '\]\]', 'nW')
if l_to == 0 || c_to == 0
return
endif
"echomsg l_to . " " . c_from . " " . c_to
@ompugao
ompugao / quickdict_local.vim
Last active March 18, 2020 15:14
quickdict local
let s:bufname = 'quickdict'
let s:quickdict_local_word = ''
let s:quickdict_lines = []
let g:quickdict_path = '/Users/sifi/.vim/bundle/quickdict.vim/dict/EIJIRO-1446_nkf_utf8.txt'
function! s:openwindow()
if bufwinnr(s:bufname) == -1
execute ':split ' . s:bufname
setlocal nobuflisted
setlocal buftype=nofile noswapfile
@ompugao
ompugao / REAMD.md
Last active February 20, 2020 10:56
LLN user dictionary to save words you look into

run $ pip install flask requests beautifulsoup4

and then set http://localhost:5000/WORD to user dictionary url

@ompugao
ompugao / LICENSE
Created December 10, 2019 13:02 — forked from IshitaTakeshi/LICENSE
Huber weighted IRLS
Copyright (C) 2006, Jonathan E. Taylor
All rights reserved.
Copyright (c) 2006-2008 Scipy Developers.
All rights reserved.
Copyright (c) 2009-2018 statsmodels Developers.
All rights reserved.
@ompugao
ompugao / stylus-2019-09-14.json
Last active September 19, 2019 02:54
my stylish json
[
{
"enabled": true,
"updateUrl": null,
"md5Url": null,
"url": null,
"originalMd5": null,
"installDate": 1562593655994,
"name": "eow.alc.co.jp",
"sections": [
@ompugao
ompugao / dstarlite.cpp
Created May 4, 2019 14:13
D* Lite implementation in C++ (experimental)
////
// D* Lite implementation in C++
// @tokoro10g
// Reference: http://idm-lab.org/bib/abstracts/papers/aaai02b.pdf
////
#include <bits/stdc++.h>
using namespace std;
using Cost = float;
@ompugao
ompugao / README.md
Created March 3, 2019 06:51 — forked from gunyarakun/README.md
旺文社『表現のための実践ロイヤル英文法』別冊付録「英作文のための暗記用例文300」JSON
@ompugao
ompugao / 1.patch
Created January 30, 2019 11:59
grSim custom status patch
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4c620f3..5e72bd4 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -515,7 +515,7 @@ void MainWindow::reconnectBlueStatusSocket()
delete blueStatusSocket;
}
blueStatusSocket = new QUdpSocket(this);
- if (blueStatusSocket->bind(QHostAddress::Any,configwidget->BlueStatusSendPort()))
+ if (blueStatusSocket->bind(QHostAddress("127.255.255.255"),configwidget->BlueStatusSendPort()))