Skip to content

Instantly share code, notes, and snippets.

View shadmansaleh's full-sized avatar
🚫
Might be slow to respond.

Shadman shadmansaleh

🚫
Might be slow to respond.
View GitHub Profile
@shadmansaleh
shadmansaleh / lenovo-fn-q.sh
Last active February 26, 2023 08:53 — forked from JoveYu/lenovo-fn-q.sh
Linux Lenove Fn+Q Power Mode Script
#!/bin/bash
ACPI_BALANCE="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x000FB001"
ACPI_POWER="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001"
ACPI_ECO="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001"
ACPI_MODE="\_SB.PCI0.LPC0.EC0.SPMO"
MODE=$(sh -c "echo '$ACPI_MODE' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call")
MODE=${MODE:2}
TARGET=$(((MODE+1)%3))
#include <bits/stdc++.h>
using namespace std;
inline int *new_query(int op, int x, int y);
inline void clear_queries(int **queries, int cnt);
int **get_queries(int cnt);
inline int get_replaced_val(unordered_map<int, int> &ref, int query);
int main() {
@shadmansaleh
shadmansaleh / nvim_conf.sh
Last active December 22, 2023 12:29
A small script to easily create and load isolated configuration for neovim
#!/bin/sh
USAGE="Usage nvim_isolated_conf.sh [OPTIONS] Directory
A tool to easily test isolated neovim config
Options:
-c Create a mimimal config tree at Directory
-e Edit init.vim of config in Directory
-h Show this message
-l Load neovim with config from Directory
-- Uses:
-- Semantic
-- require'keymap'.[?mode][?nore]map[?!]('key', 'command string | lua callback', 'patams' ...)
-- require'keymap'.nnoremap('<leader>a', function() print 'hello' end, 'silent')
-- require'keymap'.imap('<C-Space>', 'compe#complete()', 'silent', 'expr')
-- To unmap <C-Space> key
-- require'keymap'.imap('<C-Space>')
-- Copyright (c) 2020-2021 shadmansaleh
-- LICENCE: MIT
-- To see what chord cancelation means checkout https://github.com/svermeulen/vimpeccable#chord-cancellation-maps
-- Uses
-- require'keychord'.cancel('<leader>')
-- Add more suffixes to suffixes table if needed
local M = {}
@shadmansaleh
shadmansaleh / colorscheme_generator.lua
Last active January 14, 2022 06:31
Genarates colorscheme for corrent highlights in neovim
-- This script has been succeeded by
-- https://github.com/shadmansaleh/colorsceme_generator.nvim
-- Thid script is nolonger maintained so please use the plugin version.
-- This file creates a colorscheme from aleady available colorscheme
-- Author : Shadman Saleh
-- Licence : You can do whatever you want with it but do provide proper cradit
-- Uses :
lua << LUA_END
my_namespace78 = {}
function my_namespace78.setup_path()
local split_paths = vim.split(package.path, ";")
local paths = {}
for _, v in ipairs(split_paths) do
table.insert(paths, vim.fn.fnamemodify(v, ":p:h"))
end
-- =============================================================================
-- lightline to lualine theme converter
-- Author: shadman
-- License: MIT License
-- =============================================================================
-- Instructions
-- 1. Source this file in neovim with lightline installed
-- 2. execute :lua light2lualine_theme_converter('theme_name')
local lua_complete = {}
lua_complete.data = {}
lua_complete.__loadData = function(parent, parent_name)
-- check whether parent_name was passed
if parent_name == nil then
parent_name = ""
-- add . to parent_name when it's not empty
elseif parent_name ~= "" then
parent_name = parent_name .. "."