Skip to content

Instantly share code, notes, and snippets.

View flynx's full-sized avatar

Alex A. Naanou flynx

  • Moscow State University
  • Moscow, Russia
View GitHub Profile
@flynx
flynx / insert-and-back.vim
Created May 22, 2024 11:47
Vim: Insert and back (tip 314)
" Insert and back '''''''''''''''''''''''''''''''''''''''''''''''''''''
if v:version >= 700
" vim7+ version to accommodate the completion menu...
fun! s:Toggle_DropOutOfEditOnArrow()
if !exists('b:DropOutOfEditOnArrow_on') || b:DropOutOfEditOnArrow_on == 0
let b:DropOutOfEditOnArrow_on=1
imap <silent><Down> <C-R>=pumvisible( ) ? "\<lt>C-N>" : "\<lt>esc>\<lt>Down>l"<CR>
imap <silent><Up> <C-R>=pumvisible( ) ? "\<lt>C-P>" : "\<lt>esc>\<lt>Up>l"<CR>
else
let b:DropOutOfEditOnArrow_on=0
@flynx
flynx / smart-home.vim
Created May 22, 2024 11:42
Vim: Smart home (tip 315)
" Smart Home ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
fun! s:SmartHome()
if col('.') != match(getline('.'), '\S')+1
norm ^
else
norm 0
":call cursor(line('.'),2)
"norm h
endif
endfun
@flynx
flynx / readline_shortcuts.md
Created March 12, 2024 11:12 — forked from jottr/readline_shortcuts.md
readline shortcuts

Readline

GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of [readline][5] package under "Required By" for more examples). readline is also customizable (see man page for details).

Keyboard Shortcut Description

Ctrl+l Clear the screen

Cursor Movement

@flynx
flynx / make-shares
Created June 23, 2023 13:23
Proxmox: create shared directories between LXC containers, host node and prepare for sharing it via Syncthing
#!/usr/bin/bash
# config...
CT_DIR=/etc/pve/lxc/
SHARE_ROOT=/media/shared/
SYNCTHING=syncthing
SYNCTHING_DIR=/home/syncthing/Proxmox
# normalize...
@flynx
flynx / remove-nag
Last active June 7, 2023 18:14
Proxmox remove "No valid subscription" message (presonal use only)
#!/usr/bin/bash
# can be run automatically under cron:
# 0 5 * * * /root/remove-nag
FILE=proxmoxlib.js
DIR=/usr/share/javascript/proxmox-widget-toolkit
cd "$DIR"
@flynx
flynx / git-pullall
Last active May 22, 2024 11:50
A pullall commandlet for git... (moved to: https://github.com/flynx/git-utils )
#!/bin/bash
# config...
#
#FALLBACK_TO_PULL=yes
#
while true ; do
case $1 in
@flynx
flynx / disable-hpet.ps1
Last active June 9, 2023 06:08
Fix DPC lagging on some Windows 10 systems...
# fix DPC lagging on some Windows 10 systems...
# can manifest as audion lags and studder
#
# NOTE: to reset to default use:
# bcdedit /deletevalue OPTION_NAME
#
# boot settings...
bcdedit /set useplatformclock No
bcdedit /set disabledynamictick Yes
@flynx
flynx / Windows10-Bash.Script-make-runnable.reg
Created July 1, 2019 22:34
Run Cygwin Bash scripts (*.sh) in Windows...
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.sh]
@="Bash.Script"
"Content Type"="text/plain"
[HKEY_CLASSES_ROOT\Bash.Script]
@="Bash Script"
@flynx
flynx / lisp.js
Last active May 20, 2023 11:09
a tiny little lisp interpreter written in js...
var lisp = function(c, context){
return c instanceof Array ?
(typeof(c[0]) == typeof('str')
&& c[0] in (context || ns) ?
(context || ns)[c[0]].call((context || ns),
...c.slice(1)
.map(e => lisp(e, context)))
: c.map(e => lisp(e, context)))
: c }
@flynx
flynx / module.js
Last active June 2, 2020 00:10
Template: module loadable via both node's require(..) and requirejs(..) as well as runnable as a stand-alone script via node module.js
/**********************************************************************
*
*
*
**********************************************************************/
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
(function(require){ var module={} // make module AMD/node compatible...
/*********************************************************************/