Skip to content

Instantly share code, notes, and snippets.

@endolith
endolith / peakdet.m
Last active February 14, 2024 21:27
Peak detection in Python [Eli Billauer]
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
#!/bin/bash
#updated ffmpeg progress indicator
#by Rupert Plumridge
#for updates visit www.prupert.co.uk
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence
# Based on the ffmpegprogress bar from: http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html
# which was based on my initital progress script - circle of life and all that ;)
# version 2.0
# 07.04.2011
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion
@pbnjay
pbnjay / pbnjay_bibtex.js
Created February 15, 2012 15:13
Zotero BibTeX translator with tags as citekeys (updated 23rd Apr 2012)
{
"translatorID": "7b4cd20f-4c4e-4d1c-b622-cfb6e2269a1c",
"translatorType": 3,
"label": "BibTeX-citekey",
"creator": "Simon Kornblith and Richard Karnesky",
"target": "bib",
"minVersion": "2.1.9",
"maxVersion": null,
"priority": 2,
"inRepository": false,
@aszlig
aszlig / deptree.py
Created December 29, 2012 00:38
Generate GraphViz dependency tree of a TaskWarrior task.
#!/usr/bin/env python
import sys
from subprocess import Popen, PIPE
from json import loads
class Task(object):
def __init__(self, data):
self.data = data
@mllg
mllg / Tmpwatch
Last active March 19, 2021 04:16
Utility vim function to clean up vim's undo files (or others).
function Tmpwatch(path, days)
let l:path = expand(a:path)
if isdirectory(l:path)
for file in split(globpath(l:path, "*"), "\n")
if localtime() > getftime(file) + 86400 * a:days && delete(file) != 0
echo "Tmpwatch(): Error deleting '" . file . "'"
endif
endfor
else
echo "Tmpwatch(): Directory '" . l:path . "' not found"
@winny-
winny- / force-inet4-or-inet6.c
Last active May 7, 2024 07:20
Force IPv4 or IPv6 in applications such as Lynx
/*
force-inet4-or-inet6.c - hack to force applications to use IPv4 or IPv6 exclusively
compilation: cc -fPIC -shared -DUSE_INET4 -o force-inet4.so force-inet4-or-inet6.c
cc -fPIC -shared -DUSE_INET6 -o force-inet6.so force-inet4-or-inet6.c
usage: LD_PRELOAD=/path/to/library.so program args ...
This file is in the public domain.
*/
@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@jimschubert
jimschubert / README.md
Last active October 30, 2023 01:33
prepare-commit-msg which adds branch name and description to the end of a commit message (git hook)

Installation

To install globally, copy prepare-commit-msg to /usr/local/share/git-core/templates/hooks and execute:

chmod +x /usr/local/share/git-core/templates/hooks/prepare-commit-msg

To install per-repository, copy prepare-commit-msg to /path/to/repo/.git/hooks/prepare-commit-msg and mark it as executable.

@vladbabii
vladbabii / mount_x.service
Created January 29, 2018 16:54
Systemd run script after mount
# original: https://askubuntu.com/questions/25071/how-to-run-a-script-when-a-specific-flash-drive-is-mounted
# you can find your device unit with: sudo systemctl list-units -t mount
# put this into /etc/systemd/system/your.service
[Unit]
Description=SharedMountTrigger
Requires=mnt-shared.mount
After=mnt-shared.mount
[Service]
@fnky
fnky / ANSI.md
Last active June 8, 2024 08:50
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27