Skip to content

Instantly share code, notes, and snippets.

@i5ar
i5ar / keymap.rb
Created July 6, 2022 11:35
PRK Firmware Keymap
# Initialize a Keyboard
kbd = Keyboard.new
# You can make right side the "anchor" (so-called "master")
# Initialize GPIO assign
kbd.init_pins(
[6, 7], # row0, row1, etc.
[9, 10] # col0, col1, etc.
)
#keyboard.row_pins = (board.GP6, board.GP7)
@i5ar
i5ar / togglechange.js
Last active April 3, 2021 13:44
Close/open or change division in React
const {name} = evt.target;
if (name === "isLayouts" || name === "isHousing") {
this.setState(s => {
const stateKeys = Object.keys(s);
const index = stateKeys.indexOf(name);
if (index !== -1) stateKeys.splice(index, 1);
return stateKeys.map(
key => ({
[key]: false
})).reduce(
@i5ar
i5ar / rename.py
Last active September 5, 2020 02:40
Rename DJI images
#!/usr/bin/env python3
# ________ ____ ____ _____ ___ ___
# / ___/ _ \/ __ \/ __ `/ __ `__ \/ _ \
# / / / __/ / / / /_/ / / / / / / __/
# /_/ \___/_/ /_/\__,_/_/ /_/ /_/\___/
"""
Replace a character from 'old' to 'new' at specific 'index'
@i5ar
i5ar / main.js
Created May 16, 2020 16:24
Update user field from email
jQuery(document).ready(function($) {
$("input#user_email").keyup(function () {
console.log(this.value);
$("input#user_login").val(this.value.split('@')[0])
});
});
@i5ar
i5ar / index.html
Created April 10, 2020 19:30
Basic Routing with React Router
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Basic Routing</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-router-dom@5.1.2/umd/react-router-dom.min.js"></script>
@i5ar
i5ar / csvmkdir.py
Last active January 28, 2020 22:31
Make directories from a CSV file
#!/usr/bin/env python
# __ __
# ___________ ______ ___ / /______/ (_)____
# / ___/ ___/ | / / __ __ \/ //_/ __ / / ___/
# / /__(__ )| |/ / / / / / / < / /_/ / / /
# \___/____/ |___/_/ /_/ /_/_/|_|\____/_/_/
"""
Make directories from a CSV file.
@i5ar
i5ar / solarized.scss
Created June 15, 2019 08:30
Solarized (dark) theme for Noty
.noty_theme__solarized.noty_bar {
margin: 4px 0;
overflow: hidden;
border-radius: 2px;
position: relative;
.noty_body {
padding: 10px;
font-size: 14px;
text-shadow: 1px 1px 1px rgba(7, 54, 66, .1);
@i5ar
i5ar / README.rst
Last active August 11, 2019 15:58
Template language

Fox

Fox template language.

Features

What makes Fox template language special.

@i5ar
i5ar / __main__.py
Created May 2, 2019 22:42
Edit Intel HEX file
from intelhex import IntelHex
from pathlib import Path
FILE_IN = Path('./in.hex')
FILE_OUT = Path('./out.hex')
# Open HEX file, replace a byte and save in a new HEX file.
# https://python-intelhex.readthedocs.io/en/latest/part2-2.html
ih = IntelHex()
@i5ar
i5ar / .eslintrc
Last active July 11, 2019 10:41
ESLint, stylelint Run Commands
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",