Skip to content

Instantly share code, notes, and snippets.

@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active January 12, 2024 10:51
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@haakov
haakov / CMakeLists.txt
Created March 3, 2018 11:16
CMake file to compile GNU Radio display_qt C++ example standalone
find_package(Qt5Widgets REQUIRED)
include_directories(
${GR_QTGUI_INCLUDE_DIRS}
${GR_ANALOG_INCLUDE_DIRS}
${GR_FILTER_INCLUDE_DIRS}
${GR_BLOCKS_INCLUDE_DIRS}
${GR_FFT_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
@nepsilon
nepsilon / how-to-output-a-range-of-lines-from-a-file.md
Created July 12, 2017 04:56
How to output a range of lines from a file? — First published in fullweb.io issue #107

How to output a range of lines from a file?

Easy enough with sed:

sed -n	123,230p filename

This will output filename content, from line 123 to line 230, inclusives. Notice the p letter after the last line number, this is what instruct sed to print to stdout.

@bradcordeiro
bradcordeiro / ltfs2csv.sh
Created May 16, 2017 20:34
Print file information from LTFS index schema to CSV format using xmlstarlet
VOLUME_UUID=$(xmlstarlet sel -t -m "/ltfsindex" -v volumeuuid "${1}")
VOLUME_NAME=$(xmlstarlet sel -t -m "/ltfsindex" -v directory[1]/name "${1}")
xmlstarlet sel -t -m ".//file" \
-o "${VOLUME_UUID}" -o "," \
-o "${VOLUME_NAME}" -o "," \
-v "extentinfo/extent[1]/startblock" -o "," \
-v name -o "," \
-v "length" -o "," \
-m "ancestor-or-self::directory" -v "name" -o "/" -b -o "," \
@xavieryao
xavieryao / typing.py
Created February 7, 2017 02:12
Always typing
import time
from telethon import InteractiveTelegramClient
from telethon.tl.types.input_peer_chat import InputPeerChat
from telethon.tl.functions.messages.set_typing import SetTypingRequest
from telethon.tl.types.send_message_typing_action import SendMessageTypingAction
client = InteractiveTelegramClient('session_name','+8613400000000',api_id=123456,api_hash='752f79bb39d8004006f00f761dab7f00')
peer = InputPeerChat(14884418)
act = SendMessageTypingAction()
fn quick-sort [li]{
if <= (count $li) 1; then
put $@li
else
quick-sort [(each { if <= $0 $li[0]; then put $0; fi } $li[1:])]
put $li[0]
quick-sort [(each { if > $0 $li[0]; then put $0; fi} $li[1:])]
fi
}
@alick
alick / isatap
Created April 14, 2016 20:05
Bring up IPv6 through ISATAP tunnel.
#!/bin/bash
# vim730: set tw=80 cc=+1:
# Bring up IPv6 through ISATAP tunnel.
version="1.0"
usage() {
cat <<EOF
USAGE:
@acgotaku
acgotaku / baidupan
Last active April 26, 2023 04:00
新版百度云盘aria2c导出下载 ,目前只实现了核心功能.
// ==UserScript==
// @name 百度网盘aria2导出工具
// @author acgotaku311
// @description 一个方便吧百度网盘的Aria2rpc导出的脚本。
// @encoding utf-8
// @include http://*n.baidu.com/s/*
// @include http://*n.baidu.com/disk/home*
// @include http://*n.baidu.com/share/link*
// @include https://*n.baidu.com/s/*
// @include https://*n.baidu.com/disk/home*
@xguse
xguse / noise.sh
Last active November 21, 2022 12:14 — forked from rsvp/noise.sh
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-10-04
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)