Skip to content

Instantly share code, notes, and snippets.

@gillesB
gillesB / git-add-by-index.sh
Last active January 18, 2019 09:37
Bash script to add a file by its index to the git staging area.
#!/usr/bin/bash
git_status=`git status --porcelain`
if [[ $# -ne 1 ]]
then
# Get modified files and their index
# nl: numbers the lines
echo "$git_status" | nl
exit 0
@gillesB
gillesB / .vimrc
Last active January 11, 2019 16:04
set number relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * set norelativenumber
augroup END
set smartcase
let mapleader = "\<Space>"
@gillesB
gillesB / .tmux.conf
Last active February 3, 2018 10:10
.tmux.conf
set-window-option -g mode-keys vi
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
#unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "putclip"
#unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xargs -0 > /dev/clipboard"
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@gillesB
gillesB / biggerVideoNeoMagazinRoyale.css
Last active February 4, 2017 10:22
Bigger Video Neo Magazin Royale - Stylish Theme
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("www.neo-magazin-royale.de") {
.header {
display: none;
}
#header {
display: none;
@gillesB
gillesB / ComboBoxColorChangerFrame.java
Last active August 29, 2015 14:02
SSCCE for the Stackoverflow issue "Change only textfield background color of editable JComboBox"
import java.awt.Color;
import java.awt.Component;
import javax.swing.Icon;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import javax.swing.plaf.metal.MetalComboBoxButton;
/**
*
@gillesB
gillesB / Stadtbildserienkatalog with Administration
Last active August 29, 2015 13:58
Stadtbildserienkatalog with Administration subtree Version: 09.04.2014
SELECT -1 AS id, '<html><!--sorter: 000--><body text=#FF0000>Administration</body></html>' AS name, NULL AS class_id, NULL AS object_id, 'N' AS node_type, NULL AS url, $inner$
SELECT -1 AS id,
'Amt' AS name,
(SELECT id
FROM cs_class
WHERE TABLE_NAME ILIKE 'sb_amt') AS class_id,
NULL AS object_id,
'N' AS node_type,
NULL AS url,
@gillesB
gillesB / gist:10234407
Created April 9, 2014 07:08
katalog prüfen ist einfacher 09,04,2014
SELECT -1 AS id,
'Ok' AS name,
(select id from cs_class where table_name ilike 'sb_stadtbildserie') AS class_id,
null AS object_id,
'N' AS node_type,
null AS url,
csdc.sb_filteredserienonlybypruefen(false) AS dynamic_children,
false AS sql_sort,
true as derive_permissions_from_class
UNION
@gillesB
gillesB / gist:10152307
Created April 8, 2014 16:31
katalog prüfen ist einfacher
SELECT -1 AS id,
'Ok' AS name,
(select id from cs_class where table_name ilike 'sb_stadtbildserie') AS class_id,
null AS object_id,
'N' AS node_type,
null AS url,
csdc.sb_filteredserienonlybypruefen(false) AS dynamic_children,
false AS sql_sort,
true as derive_permissions_from_class
UNION
SELECT -1 AS id, '<html><!--sorter: 000--><body text=#FF0000>Administration</body></html>' AS name, null AS class_id, null AS object_id, 'N' AS node_type, null AS url,'SELECT -1 AS id, ''Auftraggeber'' AS name, (select id from cs_class where table_name ilike ''arc_auftraggeber'') AS class_id, null AS object_id, ''N'' AS node_type, null AS url,''SELECT -1 AS id, upper(substr(trim(a.auftraggeber),1 ,1)) AS name, (select id from cs_class where table_name ilike ''''arc_auftraggeber'''') AS class_id, null AS object_id, ''''N'''' AS node_type, null AS url,''''SELECT -1 AS id, a.auftraggeber AS name, (select id from cs_class where table_name ilike ''''''''arc_auftraggeber'''''''') AS class_id, a.id AS object_id, ''''''''O'''''''' AS node_type, null AS url,null AS dynamic_children, false AS sql_sort from arc_auftraggeber a where upper(substr(trim(a.auftraggeber),1 ,1)) = ''''''''''''||upper(substr(trim(a.auftraggeber),1 ,1))||'''''''''''' order by a.auftraggeber'''' AS dynamic_children, false AS sql_sort from arc_