Skip to content

Instantly share code, notes, and snippets.

View Osse's full-sized avatar

Øystein Walle Osse

View GitHub Profile
@Osse
Osse / shebang.patch
Created October 18, 2012 16:50
shebang patch
From c5744b66fc7efc26dee982cb21a1a1a6b761f1a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98ystein=20Walle?= <[email protected]>
Date: Thu, 18 Oct 2012 18:48:25 +0200
Subject: [PATCH] Add shebang line to example.py
This makes it possible to run the script with e.g. './example.py'
instead of 'python example.py'.
---
example.py | 2 ++
1 file changed, 2 insertions(+)
@Osse
Osse / trans-done
Created October 23, 2012 17:51
Transmission variables
#!/bin/bash
echo '$TR_APP_VERSION:' "$TR_APP_VERSION" > ~/tr.log
echo '$TR_TIME_LOCALTIME:' "$TR_TIME_LOCALTIME" >> ~/tr.log
echo '$TR_TORRENT_DIR:' "$TR_TORRENT_DIR" >> ~/tr.log
echo '$TR_TORRENT_HASH:' "$TR_TORRENT_HASH" >> ~/tr.log
echo '$TR_TORRENT_ID:' "$TR_TORRENT_ID" >> ~/tr.log
echo '$TR_TORRENT_NAME:' "$TR_TORRENT_NAME" >> ~/tr.log
@Osse
Osse / gist:3944504
Created October 24, 2012 07:12
git status error
When running 'git status' I get the following error when my cwd is .../repo/some_subdir
fatal: internal error: work tree has already been set
Current worktree: /full/path/to/repo/
New worktree: /full/path/to/repo/some_subdir
When I am in .../repo and run 'git status' it behaves as expected. There .git is a textfile containing:
gitdir: /some/other/full/path/myrepo
@Osse
Osse / python.vim
Created October 24, 2012 17:44
Hacky hack for Python
" If the line is empty, search backwards and return the indent of the
" previous line that got an explicit number from GetPythonIndent()
if getline(a:lnum) == ''
let x = a:lnum - 1
while x > 0 && GetPythonIndent(x) == -1
let x = x - 1
endwhile
return x + 1
endif
@Osse
Osse / foo.zsh
Created October 26, 2012 05:14
Zsh array from output
osse@osse-w760:/t/tmp.lWDzqZmrtP$ cat file.txt
a 1
b 2
c 3
d 4
e 5
osse@osse-w760:/t/tmp.lWDzqZmrtP$ a=( ${(f)$(cat file.txt)} )
osse@osse-w760:/t/tmp.lWDzqZmrtP$ echo ${a[1]}
a 1 b 2 c 3 d 4 e 5
osse@osse-w760:/t/tmp.lWDzqZmrtP$
@Osse
Osse / gist:3966954
Created October 28, 2012 00:06
WEbradion transcript
I stumbled across a site called Pineapple.io. The idea is that the are gong to
create a central hub--with reviews of tools--and all sorts of stuff for
developers, and even some for designers. Sort of like the target audience for
Webradion.
As usual you can submit stuff and vote them up and down, and comment to say
"this is good" "this is bad". The idea is that as many as possible should be
able to use this and "mark as favorites" [bad translation] what they liked best
and what way you can find good stuff [something mumbly].
@Osse
Osse / pymode.patch
Created October 31, 2012 08:07
Pymode path for PEP8
diff --git a/autoload/pymode/breakpoint.vim b/autoload/pymode/breakpoint.vim
index 7d98327..e98aeba 100644
--- a/autoload/pymode/breakpoint.vim
+++ b/autoload/pymode/breakpoint.vim
@@ -1,10 +1,12 @@
fun! pymode#breakpoint#Set(lnum) "{{{
let line = getline(a:lnum)
- if strridx(line, g:pymode_breakpoint_cmd) != -1
- normal dd
+ if strridx(line, g:pymode_breakpoint_cmd[0]) != -1 &&
@Osse
Osse / format.txt
Created November 2, 2012 05:58
Formatting test
set fo+=w
set tw=80
/^Lorem/normal! gqip
finish
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
@Osse
Osse / fig.tex
Created November 2, 2012 15:23
Figure snippet
\begin{figure}
\small
\centering
\begin{tikzpicture}
\end{tikzpicture}
\caption{}
\label{fig:}
\end{figure}
@Osse
Osse / quiz.vim
Created November 4, 2012 14:24
Server name
let server_name = v:servername ? v:servername : 'vimquiz'
let b:tiktok_pid = system(findfile('bin/tiktok', &rtp).' '.server_name.' "b:timer.tick()" &')