Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / Blink_32u4_PD3.ino
Last active February 23, 2020 02:06
LED Blinking program for MONAD PCB; Use to check hardware and writing boot loader
@hidsh
hidsh / chkusb.sh
Created February 9, 2020 03:24
infinit-loop-check for specified USB device for linux - equivalent to `lsusb | grep KEYWORD`
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: chkusb.sh STRING"
exit
fi
while [ 1 ]; do
ret=`lsusb | grep "$1"`
if [ -z "$ret" ]; then
@hidsh
hidsh / Arc2Seg_US_v103y.lsp
Last active February 4, 2025 02:42
AutoCAD/IntelliCAD: A lisp command to convert Arc to a segmented line
;;
;; Generation de polygones reguliers sur les Arcs , Cercles et Arcs dans Polylignes
;;
;; Les XDatas sont copiees sur la nouvelle polyligne.
;;
;; Routine: ARC2SEG vers 1.03 par Gilles (gile) le 10 Nov 2008
;; Transforme les arcs, cercles et polyarcs en polylignes constituees de segments droits
;;
;; 1 - Correction du bug sur les arcs > 180 degres
;;
@hidsh
hidsh / result.txt
Last active October 30, 2020 23:22
C test: var-args, like printf()
❯❯❯ gcc variable_length_arg_func.c && ./a.out
var:01
var1:11 var2:12
var1:F1 var2:F2 var3:F3
@hidsh
hidsh / kicad-rename.py
Created July 15, 2019 20:33
changing filename of gerber files
#!/usr/bin/python
# changing filename of gerber files
# usage:
# $ cd GERBER-FOLDER
# $ kicad-rename.py
#
# equivalent to following commands:
# mv hoge-F_Cu.gtl hoge.gtl
# mv hoge-F_Mask.gts hoge.gts
[url "[email protected]:"]
pushinsteadof = https://github.com/
[user]
name = hidsh
email = [email protected]
[push]
default = simple
[core]
editor = vim -u NONE -c \"set fenc=utf-8\"
whitespace = cr-at-eol
@hidsh
hidsh / init.lua
Created January 1, 2019 01:45
Scrolling by Middle button + TrackPoint with SK-8855 (ThinkPad USB Keyboard With TrackPoint)
-- Scrolling by Middle button + TrackPoint with SK-8855 (ThinkPad USB Keyboard With TrackPoint) on Mojave
-- save as: ~/.hammerspoon/init.lua
--
-- HANDLE SCROLLING
local deferred = false
overrideMiddleMouseDown = hs.eventtap.new({ hs.eventtap.event.types.middleMouseDown }, function(e)
--print("down"))
deferred = true
@hidsh
hidsh / ptr_plus_plus_2.c
Created November 16, 2018 19:47
c: test2: (*p)++; is what we will probably want as a counter
// what we will probably want is:
// (*p)++; == v++;
#include <stdio.h>
void print_arr(int a[])
{
for(int i=0; i<3; i++) {
printf("%d\n", a[i]);
}
}
@hidsh
hidsh / ptr_plus_plus.c
Created November 16, 2018 19:12
c: test: *p++ = v; is what we will probably want setting values in the loop
// all the same:
// *p++ = x
// *(p)++ = x
// *(p++) = x
//
#include <stdio.h>
void print_arr(int a[])
{
for(int i=0; i<3; i++) {
@hidsh
hidsh / kicad_rename_gerber_elecrow.sh
Created October 12, 2018 22:42
shell script: rename gerber files to place an order to elecrow.com
#!/bin/sh
#
# Rename gerber-files from KiCAD to place an order to `elecrow.com`
#
# This script is fully based on renamer_elecrow.sh by tnishinaga: https://gist.github.com/tnishinaga/feeb86415ecf977a59615baa9846e4e0
# THX!
#
usage()
{
echo "Rename gerber-files from KiCAD according to elecrow.com's order-rules"