Skip to content

Instantly share code, notes, and snippets.

View s1n7ax's full-sized avatar
🏠
Working from home

Srinesh Nisala s1n7ax

🏠
Working from home
View GitHub Profile
@s1n7ax
s1n7ax / sensor-light.yaml
Created September 29, 2024 17:14 — forked from Blackshome/sensor-light.yaml
Home Assistant Sensor Light that can be used in Blueprints
blueprint:
name: Sensor Light
description: >
# 💡 Sensor Light
**Version: 7.1**
Your lighting experience, your way - take control and customize it to perfection! 💡✨
@s1n7ax
s1n7ax / lua-snip-keymaps.lua
Last active September 10, 2024 06:49
LuaSnip keymaps written in lua
local ls = require('luasnip')
local M = {}
function M.expand_or_jump()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end
@s1n7ax
s1n7ax / colemak.lua
Created February 1, 2023 05:49
Colemakify the QWERTY keymaps in Neovim
local mode = { 'n', 'x', 'o' }
vim.keymap.set(mode, 'm', 'h', { desc = 'Left' })
vim.keymap.set(mode, 'M', 'H', { desc = 'Top line of window' })
vim.keymap.set(mode, 'h', 'i', { desc = 'Insert' })
vim.keymap.set(mode, 'H', 'I', { desc = 'Insert at line start' })
vim.keymap.set(mode, 'n', 'j', { desc = 'Down' })
vim.keymap.set(mode, 'N', 'J', { desc = 'Join below line' })
vim.keymap.set(mode, 'k', 'n', { desc = 'Find next' })
vim.keymap.set(mode, 'K', 'N', { desc = 'Find previous' })
vim.keymap.set(mode, 'e', 'k', { desc = 'Up' })
@s1n7ax
s1n7ax / init.lua
Created May 22, 2022 09:44
Show file path in the winbar
vim.o.winbar = "%{%v:lua.require'nvim.utils.nvim.winbar'.eval()%}"
@s1n7ax
s1n7ax / gen_doc_comment.lua
Last active May 19, 2022 00:59
Generate Java Doc comment using Treesitter in Neovim
local ts_utils = require("nvim-treesitter.ts_utils")
local ts_locals = require("nvim-treesitter.locals")
local ts_indent = require("nvim-treesitter.indent")
function get_method_node()
local curr_node = ts_utils.get_node_at_cursor()
local scope = ts_locals.get_scope_tree(curr_node, 0)
local method_node = nil
for _, node in ipairs(scope) do
@s1n7ax
s1n7ax / poke.js
Last active August 16, 2020 10:54
poke em all
const resolveXpath = $x;
const wait = (timeout) => {
return new Promise((res) => setTimeout(res, timeout));
};
const clickPoke = () => {
const wrap = async () => {
const buttons = resolveXpath(
`//span[text() = 'Poke']/ancestor::div[@role="button" and @aria-label="Poke"]`
// promisified setTimeout
const wait = async time => {
return new Promise(res => {
setTimeout(res, time);
});
};
// return random number in given min max range
const getRandomNumber = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min);
@s1n7ax
s1n7ax / commonjs_n_ex6_module_export.js
Last active March 21, 2020 09:46
techminister.com cypress-first-impression
// CommonJS default export
module.exports = () => {
// do something
}
// ES6 module default export
export default () => {
// do something
}