Skip to content

Instantly share code, notes, and snippets.

@peterhost
peterhost / markdown.vim
Created October 15, 2019 14:04
Here's a tweaked version of the `vim-markdown/ftplugin/markdown.vim` (from plasticboy's vim-markdown extension) which displays numbered entries for the `:Toc` command. As I have no idea if the issue you opened is of interest for plasticboy, I did it directly in the `s:Toc()` function (the only part of the code I edited). It should be parameteriz…
"TODO print messages when on visual mode. I only see VISUAL, not the messages.
" Function interface phylosophy:
"
" - functions take arbitrary line numbers as parameters.
" Current cursor line is only a suitable default parameter.
"
" - only functions that bind directly to user actions:
"
" - print error messages.
@peterhost
peterhost / ccd.md
Created August 1, 2012 00:43
openvpn setup

ccd dir :

$ cat client1
ifconfig-push 10.20.30.21 10.20.30.22

$ cat client2

ifconfig-push 10.20.30.17 10.20.30.18

@peterhost
peterhost / quix.txt
Created November 27, 2011 16:19
Peter Host's custom Quix commands
> Peter Host's Custom Quix Commands
> TITLE: quix.txt
> GITHUB: https://raw.github.com/peterhost/quix/master/quix.txt
> MORE: http://quixapp.com
>---------------------
> QUIX
>---------------------
edit http://gist.github.com/gists/1397755/edit Edit my Quix Commands
// modified from code of "JQuerify" bookmarklet
// http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
(function() {
function z(a, b) {
var c = document.createElement("script");
c.src = a;
var d = document.getElementsByTagName("head")[0], e = !1;
c.onload = c.onreadystatechange = function() {
!e && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") && (e = !0, b(), c.onload = c.onreadystatechange = null, d.removeChild(c));
};
@peterhost
peterhost / Filtrer une recherche twitter
Created July 28, 2011 09:57
Filtrer une recherche twitter
Ca arrive à tout le monde : vous désirez suivre une tendance sur twitter et faites une recherche sur vos mots clé préférés. Mais un utilisateur pollue ce mot clé avec ses inepties à répétition. C'est un spammeur, un troll, il provoque en vous des montées d'énervement qui nuisent à votre Zen quotidien.
La solution est simple : filtrez le.
Twitter met à votre disposition quelques outils pour affiner vos recherches. La liste est ici : http://search.twitter.com/operators
Cela permet de tout faire ou presque.
Le cas le plus commun est "comment faire en sorte que les messages du troll ne s'affichent plus dans ma recherche ?"
Exemple concret :
@peterhost
peterhost / node_debian_init.sh
Created November 25, 2010 11:41
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@peterhost
peterhost / findall.sh
Created November 12, 2010 16:52
FIND string in files: bash script to easilly find a given string in all files of a given type in the current directory and its subdirectories (.git dirs excluded) and print the results with some colors
# ---------------------------------------------------------------------------
# FIND string in (regular) files
# https://gist.github.com/674341
# -> finds a given string in all files of a given type in the current
# directory and its subdirectories (.git directory contents excluded,
# directories excluded)
function findall()
{
#CUSTOM COLORS : declare them as local variables so as not to clutter your BASH ENVIRONMENT
@peterhost
peterhost / screen.rb
Created October 27, 2010 19:18
homebrew formula for screen, hacked from macports
require 'formula'
# This duplicates the system "screen", but fixes the ability
# to use vertical splits.
class Screen <Formula
# this tarball contains a quick and dirty fix :
# 1 - included a copy of the ".orig" files required by the 'patch-wrp_vertical_split.patch' :p0 patches,
# in the tarball's root dir
# 2 - copied 'vproc_priv.h' in the root of the tarball (required by 'patch-screen.c' (osX10.5) and
--- screen.c.orig 2009-01-21 12:06:11.000000000 +0800
+++ screen.c 2009-01-21 12:08:27.000000000 +0800
@@ -101,6 +101,11 @@
#include "logfile.h" /* islogfile, logfflush */
+#ifdef __APPLE__
+#include <vproc.h>
+#include "vproc_priv.h"
+#endif
--- comm.c.orig 2003-09-08 14:25:08.000000000 +0000
+++ comm.c 2006-07-07 02:39:24.000000000 +0000
@@ -309,6 +309,7 @@ struct comm comms[RC_LAST + 1] =
{ "vbellwait", ARGS_1 },
{ "verbose", ARGS_01 },
{ "version", ARGS_0 },
+ { "vert_split", NEED_DISPLAY|ARGS_0 },
{ "wall", NEED_DISPLAY|ARGS_1},
{ "width", ARGS_0123 },
{ "windowlist", NEED_DISPLAY|ARGS_012 },