Skip to content

Instantly share code, notes, and snippets.

@longjie
longjie / Caps2Ctrl.reg
Created May 7, 2019 00:11
Set Caps key to Ctrl key in Windows 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@longjie
longjie / gwall.py
Last active September 14, 2020 14:41
This is a simple python file for the demo "gWall: gWall: LCD+RasPi+Google Assistant" (https://www.youtube.com/watch?v=Y-H_3o7vKcc)
#!/usr/bin/env python
# Copyright (C) 2017 Google Inc.
# Copyright (C) 2017 Ryosuke Tajima
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@longjie
longjie / gist:c4ea4c04a7426eff68cf083ea936446d
Created February 16, 2017 12:39
Emacs setting to run GNU indent automatically after save C/C++ files
;; Function to format C/C++ code with GNU indent
(defun c-auto-format ()
"Function to format C/C++ code with GNU indent"
(interactive)
(when (find major-mode '(c-mode c++-mode))
(shell-command
(format "indent %s" (shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
;; Add after-save-hook
(add-hook 'after-save-hook 'c-auto-format)
@longjie
longjie / datafile.py
Last active April 3, 2016 07:20
スペース区切りのファイルに対するデータの読み書き
#!/usr/bin/env python
from __future__ import print_function
data = [['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h', 'i']]
# write data
with open('data.txt', 'w') as file:
@longjie
longjie / gist:976dd847d927a1692951
Created July 15, 2015 02:55
テクスチャのついていないCOLLADAファイルに色とテクスチャをMeshlabでつける手順
rvizではメッシュの色(Vertex Color)は反映されず、テクスチャにする必要があるみたい。
meshlabでテクスチャ付きのCOLLADAファイルを作る方法をメモ。
meshlab ver.1.33
* メッシュをインポート
* Z-paintingツールでメッシュに色をつける
* Filters->Texture->Parametrization:Trivial Per Triangleを選択
* パラメータはデフォルトのままでApply
* Filters->Texture->Vertex Color to Textureを選択