Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / .gitconfig
Last active June 5, 2021 01:38
my "~/.gitconfig"
[credential]
helper = manager
[url "[email protected]:"]
pushinsteadof = https://github.com/
[user]
name = hidsh
email = [email protected]
[push]
default = simple
[core]
@hidsh
hidsh / map.c
Created August 27, 2018 16:12
`map' macro in c-language from arduino
// `map' function from arduino
//
// thx to "http://www.musashinodenpa.com/arduino/ref/index.php?f=0&pos=2743"
#include <stdio.h>
#define MAP(x, in_min, in_max, out_min, out_max) \
((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min)
typedef __int16_t int16_t;
@hidsh
hidsh / *scratch*.el
Created August 16, 2018 00:46
elisp: test of monkey-patching using `setf'
(defun ori ()
"original")
(defun modi ()
"modi")
(ori) ; => "original"
(modi) ; => "modi"
(setf (symbol-function 'ori) (symbol-function 'modi))
@hidsh
hidsh / *scratch*.el
Created August 15, 2018 20:57
elisp: test of monkey-patching using `letf`
(defun ori ()
"original")
(defun modi ()
"modi")
(ori) ; => "original"
(modi) ; => "modi"
(letf (((symbol-function 'ori)
@hidsh
hidsh / dot.el
Created August 7, 2018 19:36
.emacs in order to backup/restore init files
;;; -*- coding:utf-8; mode:emacs-lisp -*-
;;;
;;; ~/.emacs.d/dot.emacs
;;;
;;; $ ln -s ~/.emacs.d/dot.emacs ~/.emacs
;;;
;;
;; functionalities to backup/restore init files
;;
@hidsh
hidsh / init.el
Created August 5, 2018 09:55
elisp: counsel-rg-at-point
;; why doesn't exist this feature
(defun counsel-rg-at-point ()
(interactive)
(counsel-rg (symbol-name (symbol-at-point))))
@hidsh
hidsh / *scratch*.el
Last active August 15, 2018 21:02
elisp: test to break from loop using `catch' and `throw'
(defun test-break ()
(let ((s ""))
(if (catch 'break
(dolist (f l)
(if (string= f "foo") (throw 'break nil))
(setq s (concat s f " ")))
t)
(message "success: %s" s)
(message "fail: %s" s))))
@hidsh
hidsh / analog_joy_calibrator.ino
Created July 30, 2018 21:34
arduino test tool for calibration of analog joypad
#include <stdio.h>
#define JOY_X A0
#define JOY_Y A1
void setup() {
pinMode(JOY_X, INPUT);
pinMode(JOY_Y, INPUT);
Serial.begin(38400);
@hidsh
hidsh / analog_joy.ino
Created July 30, 2018 20:42
arduino test of most simple usage for analog joy pad
#include <stdio.h>
#define JOY_L_X A0
#define JOY_L_Y A1
void setup() {
pinMode(JOY_L_X, INPUT);
pinMode(JOY_L_Y, INPUT);
Serial.begin(38400);
@hidsh
hidsh / analogRead_zero_adjust.ino
Created July 30, 2018 13:16
arduino test for zero adjust
#include <stdio.h>
#define JOY_L_X A0
#define JOY_L_Y A1
#define ZERO_THRESH 10
#define MAX 490
void setup() {
pinMode(JOY_L_X, INPUT);
pinMode(JOY_L_Y, INPUT);