recentpopularlog in

kme : configfile   366

« earlier  
SSH tunnelling for fun and profit: SSH Config
<code>
# turn on pubkey auth per host
Host c1
HostName 192.168.0.1
PubkeyAuthentication yes
IdentityFile ~/.ssh/id_rsa_specific

# turn off pubkey auth for all hosts
Host *
PubkeyAuthentication no
IdentitiesOnly yes
</code>
<code>
# only store hashes of the hostnames
Host *
HashKnownHosts yes
</code>
<code>
# multiplex connections
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
</code>
ssh  ssh_config  configfile  bestpractices  security  hardening 
4 days ago by kme
scripting - How to parse and convert ini file into bash array variables? - Server Fault
<code class="language-bash">eval $(git config -f mytool.ini --list | tr . _)</code>
bash  associativearray  configfile  ini  parsing  git  gitconfig  solution 
19 days ago by kme
Shell Tricks: .inputrc binding fun - BrettTerpstra.com
In Bash, there are some great but lesser-known default bindings. You may know that Option-. will insert the last argument of the previous command (e.g. running ls ~/Desktop and then typing cd and pressing Option-. will turn it into cd ~/Desktop), but did you know you can actually yank the argument at any index from the last command (without using history or ! operators)?

Just press Option-[#], where # is the position of the argument you want, then type Option-. to insert it in the current command.
inputrc  bash  dotfile  configfile 
7 weeks ago by kme
X resources - ArchWiki | https://wiki.archlinux.org/
Load a resource file (such as the conventional .Xresources), replacing any current settings:
<code class="language-bash">
$ xrdb ~/.Xresources
</code>

Load a resource file, and merge with the current settings:
<code class="language-bash">
$ xrdb -merge ~/.Xresources
</code>

Note:
Most Display managers load the ~/.Xresources file on login.
The older ~/.Xdefaults file is read when an X11 program starts, but only if xrdb has not been used in the current session. [1]
x11  configfuration  xdefaults  xresources  reference  xterm  urxvt  configfile  dotfile 
12 weeks ago by kme
Move through wrapped lines | Vim Tips Wiki | FANDOM powered by Wikia
I ended up using a combination of this tip and the one from https://vim.fandom.com/wiki/Move_cursor_by_display_lines_when_wrapping
My current settings are:
<code class="language-vim">map <silent> <Up> gk
imap <silent> <Up> <C-o>gk
map <silent> <Down> gj
imap <silent> <Down> <C-o>gj
map <silent> <home> g<home>
imap <silent> <home> <C-o>g<home>
map <silent> <End> g<End>
imap <silent> <End> <C-o>g<End>

setlocal linebreak
setlocal nolist
setlocal display+=lastline</code>
vim  configfile  wrapping  scrolling  cursormotion  annoyance  sortof  solution 
july 2019 by kme
Move cursor by display lines when wrapping | Vim Tips Wiki | FANDOM powered by Wikia
I ended up using a combination of this tip and the one from https://vim.fandom.com/wiki/Move_through_wrapped_lines.
You can add the following to get the `standard keys' to work:
<code class="language-viml">
noremap <silent> k gk
noremap <silent> j gj
noremap <silent> 0 g0
noremap <silent> $ g$</code>

If you copy the code from the tip into your vimrc file, make sure that you delete trailing spaces from each line, AND that you put the new code near the bottom of the vimrc file. If the code is near the top of vimrc, something coming after it might redefine those keys.

Unfortunately, this tip breaks the movement commands in conjunction with other commands. For example, d<Down> will no longer delete two lines but delete from the cursor to the position in the next line.

But you can still use j to move down by a physical line, and dj will do what you want.
You can avoid this by mapping the keys in the operator-pending mode as well:
<code class="language-viml">
onoremap <silent> j gj
onoremap <silent> k gk</code>
vim  keybinding  configfile  scrolling  cursormotion  annoyance  sortof  solution 
july 2019 by kme
Preserve bash history in multiple terminal windows - Unix & Linux Stack Exchange
True dat:
@Oli wrote, "I can't think of an intelligent way to do it where existing terminals only see their own history but new ones see a chronologically accurate list of commands." How about (untried): export PROMPT_COMMAND="history -a; $PROMPT_COMMAND". Existing shells will add each command to the history file for new shells to see, but only show their own histories.


Many solutions proposed, all with caveats, but this is what I decided on:

<code class="language-bash">
HISTCONTROL=ignoredups:erasedups # no duplicate entries
HISTSIZE=100000 # big big history
HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite

# append current history list to the history file after each command finishes
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }history -a"</code>

This appends lines to the history file after each command, which makes them available in other sessions, but up arrow will still reverse through the history only for the current session, which is probably less confusing.

You can bring in commands from other sessions (which have been written to the history file) with 'history -n'. Depending on the setting of 'HISTCONTROL', these might end up getting written out to the history file again, though. ¯\_(ツ)_/¯
bash  history  histfile  historyexpansion  frustration  configfile  forthecomments  solution 
july 2019 by kme
Bash eternal history
Many times I've found myself using Ctrl-R in Bash to get a old command four times the terminal width, just to find out that too many days have passed and it's no longer in the .bash_history file. Here are two lines that will keep track of every command line you type at the bash prompt and use no external processes at all, just plain bash.

My first approach to this problem was increasing the maximum number of lines in the history to a very large quantity. But no matter how large it was, there was always a moment when I needed a long command I typed many months ago and it had already left the history. The current solution came to my mind when I learned about the PROMPT_COMMAND variable, a command that bash executes before showing each prompt. Here are the two lines:
<code class="language-bash">export HISTTIMEFORMAT="%s "
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \
"$(history 1)" >> ~/.bash_eternal_history'</code>
bash  history  histfile  configfile  maybesolution 
july 2019 by kme
7 Tips - Tuning Command Line History in Bash - ShellHacks
There's nothing here that isn't in the manual, but it's a concise reference that's all in one place. Every 'shopt' and 'HISTCONTROL' option listed here seems to be supported in Bash 4.1 and above (this means CentOS 6).

The 'PROMPT_COMMAND' example, though, would clobber an existing PROMPT_COMMAND, so do it like this instead:
<code class="language-bash">PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }history -a"</code>
bash  history  histfile  configfile  dotfile  essential  movein  reference 
july 2019 by kme
r - Saving and loading history automatically - Stack Overflow
In my ~/.profile I have:
<code class="language-bash">export R_HISTFILE=~/.Rhistory</code>

In my ~/.Rprofile I have:
<code class="language-R">if (interactive()) {
.Last <- function() try(savehistory("~/.Rhistory"))
}</code>

and that works for me (although it doesn't work very well if you have multiple R sessions open). I also have
<code class="language-bash">alias R='R --no-save --no-restore-data --quiet'</code>

in my profile which eliminates the questions on close.
r  repl  history  configfile  annoyance  solution  fuckina 
june 2019 by kme
Share your .screenrc : linux
r/linux: All things Linux and GNU/Linux -- this is neither a community exclusively about the kernel Linux, nor is exclusively about the GNU operating system.
screen  showmeyour  screenrc  dotfile  configfile 
may 2019 by kme
A nice default screenrc · GitHub
A nice default screenrc. GitHub Gist: instantly share code, notes, and snippets.
screen  screenrc  configfile  dotfile  movein  newbie  terminalmultiplexer 
may 2019 by kme
Linuxart » Blog Archive » Super-useful inputrc | https://web.archive.org/
Not sure if really *any* of these work. Or maybe they just *work* now, by default, for most Linux distros, since this post was from 2005.
inputrc  dotfile  configfile 
april 2019 by kme
A ~/.inputrc for Humans - Top Bug Net | https://www.topbug.net/
<code class="language-inputrc">
$include /etc/inputrc
"\C-p":history-search-backward
"\C-n":history-search-forward

set colored-stats On
set completion-ignore-case On
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
set visible-stats On
</code>

I would add these, too:
<code class="language-inputrc">
$if mode=vi
set keymap vi-command
# these are for vi-command mode
"\e[A": history-search-backward
"\e[B": history-search-forward

set keymap vi-insert
# these are for vi-insert mode
"\e[A": history-search-backward
"\e[B": history-search-forward

# source: https://brettterpstra.com/2015/07/09/shell-tricks-inputrc-binding-fun/
"\e[1;5C": forward-word
"\e[1;5D": backward-word
$endif
</code>
bash  commandline  editing  configfile  dotfile  movein  essential  newbie  inputrc  readline 
april 2019 by kme
readline - python tab completion Mac OSX 10.7 (Lion) - Stack Overflow | https://stackoverflow.com/
Putting this in a ~/.pythonrc works for Python >= 3. Python 2.7.x seems to require that you set PYTHONSTARTUP=~/.pythonrc in your login scripts.

<code class="language-python">import readline
import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")</code>
python  macos  osx  repl  tabcompletion  autocompletion  annoyance  configfile  essential  movein 
march 2019 by kme
Autocompletion for your python shell|console|interpreter | http://blog.e-shell.org/
You really do need to set PYTHONSTARTUP in your login scripts.
So, all you have to do is, first, add this two lines to a file, for example, called .pythonrc in your home:
<code class="language-bash">cat ~/.pythonrc
# import rlcompleter, readline
# readline.parse_and_bind('tab:complete')
</code>

Second, add the PYTHONSTARTUP variable to your shell profile file. If you are using csh, tcsh or similar shells, this will do it:
<code class="language-bash">echo "setenv PYTHONSTARTUP ~/.pythonrc" >> ~/.cshrc</code>

If your shell is sh, bash, ksh or similars, this will do it:
<code class="language-bash">echo "export PYTHONSTARTUP=~/.pythonrc" >> ~/.profile</code>


On macOS, where the system Python is probably compiled against libedit instead of readline, you need to do this instead:

<code class="language-python">import readline
import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")</code>
python  repl  autocompletion  tabcompletion  configfile  dotfile  solution 
march 2019 by kme
Manual:Image administration - MediaWiki | https://www.mediawiki.org/
Animated GIFs don't scale with the built in PHP routines. And yet the cached (broken) thumbnails aren't refreshed without expiring the cache.

This combination of stuff was required after I discovered that I had to enable ImageMagick in order to get thumbnails of GIFs:

<code class="language-php"># source: https://www.mediawiki.org/wiki/Manual:Image_administration#Image_thumbnailing
# this should enable scaling of GIF images; built-in PHP routines won't
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/bin/convert';

# if rendered thumbnails are older than this timestamp, they are regenerated
# copy-pasted from https://www.mediawiki.org/wiki/Manual:$wgCacheEpoch
$wgThumbnailEpoch = 20190314215957;
$wgCacheEpoch = 20190314215957;

# temporarily remove shell time and memory limits (if necessary)
# source: https://www.mediawiki.org/wiki/Manual:$wgMaxShellMemory
#$wgMaxShellTime = 0;
#$wgMaxShellMemory = 0;
</code>
mediawiki  images  uploads  multimedia  animatedgifs  imagemagick  configfile  annoyance  solution 
march 2019 by kme
Mapping keys in Vim - Tutorial (Part 1) | Vim Tips Wiki | FANDOM powered by Wikia | https://vim.fandom.com/
So put these lines in ~/.vim/after/ftplugin/mediawiki.vim in order for 'j' and 'k' to just "do what I mean" in MediaWiki / Markdown source files.
The following commands map the 'j' key to execute 'gj' and the 'k' key to execute 'gk'. These are useful for moving between long wrapped lines.

<code class="language-viml">:nnoremap k gk
:nnoremap j gj</code>
vim  keymap  remapping  configfile  essential  movein 
march 2019 by kme
pip install --user should check that the user's $PATH is correct · Issue #3813 · pypa/pip | https://github.com/
On Unix, pip install --user ... drops scripts into ~/.local/bin. Historically, this directory has not been on the default Debian/Ubuntu $PATH. This is hopefully on its way to being fixed (bash 4.3-15 is on its way into Debian unstable no...
pip  path  configfile  bashrc  bash_profile  solution  newbie 
march 2019 by kme
bash - How can I prevent unsupported 'shopt' options from causing errors in my .bashrc? - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
But if you really dislike redirecting the error away, you can use the completion mechanism to perform introspection. This assumes that you don't have antiquated machines with bash ≤ 2.03 that didn't have programmable completion.
<code class="language-bash">
shopt_exists () {
compgen -A shopt -X \!"$1" "$1" >/dev/null
}
if shopt_exists direxpand; then
shopt -s direxpand
fi
</code>

This method avoids forking, which is slow on some environments such as Cygwin. So does the straightforward 2>/dev/null, I don't think you can beat that on performance.
bash  configfile  shellscripting  shopt  programmablecompletion  tabcompletion  schooling  solution 
february 2019 by kme
bash - How to expand filenames with Tab, even when a shell variable is used in the path? - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
The solution is 'shopt -s direxpand' in Bash 4.2 or later. This is (supposedly) the default on 4.1 and earlier. I learned that "Ctrl+Alt+E" does something cool when you 'set -o emacs', though:
For example, typing less $lh/acc then hitting Tab will expand to: less \$lh/access_log.

Of course, what I would like instead is less $lh/access_log or even less /var/log/httpd/access_log. (weirdly, with the cd command the autocomplete doesn't work at all in that case, this question already talks about it)

I know that there is an alternative by using shell-expand-line (default key: Ctrl+Alt+E), but it's far from perfect because it expands aliases as well, and it doesn't quote paths with special chars (spaces, ...).
bash  tabcompletion  movein  configfile  interesting 
february 2019 by kme
bash - Set and Shopt - Why Two? - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
The difference is in the changed environment variable used by bash. Setting with the set command results in $SHELLOPTS. Setting with the shopt command results in $BASHOPTS.
bourne  bash  shell  configfile  configuration  history  butwhy  explained 
february 2019 by kme
linux - bash: variable name not being expanded with Tab completion - Super User | https://superuser.com/
shopt -s direxpand will make echo $HOME/<tab> expand to echo /home/matt/ in bash 4.2. In bash 4.1 it should be the default.
bash  tabcompletion  bashcompletion  commandline  shell  configfile  essential  movein  annoyance  solution  fuckina 
february 2019 by kme
Xterm Titles With Bash - David Pashley.comDavid Pashley.com | https://web.archive.org/
<code class="language-bash">
if [ "$SHELL" = '/bin/bash' ]
then
case $TERM in
rxvt|*term)
set -o functrace
trap 'echo -ne "\e]0;"; echo -n $BASH_COMMAND; echo -ne "\007"' DEBUG
export PS1="\e]0;$TERM\007$PS1"
;;
esac
fi
</code>
bash  dynamictitle  xterm  configfile  ps1  promptstring  maybesolution 
january 2019 by kme
add a docker configuration file · Issue #937 · moby/moby | https://github.com/
Answer: there apparently is no '/etc/docker/docker.conf'; on Debian-derived distros, there's an /etc/default/docker, where you can set the DOCKER_OPTS environment variable for the daemon, though.
docker  ubuntu  debian  centos  configfile  configuration  reference 
january 2019 by kme
Best way to move docker directory · Issue #3127 · moby/moby | https://github.com/
Good evening, I'm looking for the best way to move docker directory (default /var/lib/docker) to another directory. (Technically other disk partition) I'm using devicemapper, and I think a lot of things are mounted, so it's not as easy a...
docker  configfile  centos  ubuntu  migration  reference 
january 2019 by kme
autocomplete - Disable bash tab completion - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
Dennis' solution
<code class="language-bash">
bind 'set disable-completion on'
</code>

can be done on the fly in Bash as well. You do not need to put it in .bashrc.

Musta's solution (bash --noediting) works but also disables command line editing.

Another way is
<code class="language-bash">
bind -u complete
</code>

(unset key binding associated with 'complete')

http://www.gnu.org/software/bash/manual/bashref.html, 4.2 Bash Builtin Commands.
bash  configsetting  configfile  completion  tabcompletion  itsslow  fuckina  solution 
november 2018 by kme
You can make readline (and bash) much more user friendly by adding a few options to ~/.inputrc : commandline | https://www.reddit.com/
set completion-prefix-display-length 2

This one is insanely useful when you have a folder with lots of similarly named files and you are not sure how far the completion has gone when you press TAB. The first part that has been completed will be replaced by "...", and it is simple to see what you need to type to finish the completion.
inputrc  input  readline  bash  cli  configfile  configsettings  example  newbie  movein  essential 
october 2018 by kme
readline - How do I reload .inputrc using a bash script? - Super User | https://superuser.com/
Use the bind command:
<code class="language-bash">
bind -f ~/.inputrc
</code>

See help bind for more information:
<code>
-f filename Read key bindings from FILENAME.
</code>
keybindings  macros  inputrc  bash  configfile  configsettings  solution 
october 2018 by kme
bash - How do I reload .inputrc? - Super User | https://superuser.com/
Interesting, but doesn't work for me.
By default, C-x C-r is bound to re-read-init-file.

See the Bash Reference Manual for explanation.


Maybe this does:
bind -f ~/.inputrc
bash  inputrc  keyboard  readline  configfile  dammitbrain 
october 2018 by kme
linux - How to show line number when executing bash script - Stack Overflow | https://stackoverflow.com/
<code class="language-bash">export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'</code>
bash  shellscripting  devel  debugging  configfile  movein  tipsandtricks  solution 
august 2018 by kme
webdav - How do I enable HTTP-DAV in Apache? - Server Fault | https://serverfault.com/
Yup, I made this mistake, too:
I finally figured it out.

Instead of
<code class="language-apache"><Location /var/www/html/updates>
Dav On
</Location></code>

it needs to be (Directory instead of Location)
<code class="language-apache"><Directory /var/www/html/updates>
Dav On
</Directory></code>
apache  webmaster  configfile  webdav  solution  fuckina 
august 2018 by kme
Mailing List Archive: Re: MediaWiki 1.28.0 Extension LDAPAuthentication does not work | https://lists.gt.net/
There is a new permission available that governs the right to create accounts when logging in with an external user account. It's called "autocreateaccount" [0]. You have to add to your config something like:
<code class="language-php">$wgGroupPermissions['*']['autocreateaccount'] = true;</code>

Or maybe this is enough:
<code class="language-php">$wgGroupPermissions['user']['autocreateaccount'] = true;</code>

See also https://www.mediawiki.org/wiki/Topic:T6s2lkqumdyy0zqv
mediawiki  ldap  authentication  config  configfile  solution 
june 2018 by kme
php - Removing X-Powered-By - Stack Overflow | https://stackoverflow.com/

I think that is controlled by the expose_php setting in PHP.ini:
<code class="language-php">expose_php = off</code>

Decides whether PHP may expose the fact that it is installed on the server (e.g. by adding its signature to the Web server header). It is no security threat in any way, but it makes it possible to determine whether you use PHP on your server or not.

There is no direct security risk, but as David C notes, exposing an outdated (and possibly vulnerable) version of PHP may be an invitation for people to try and attack it.
php  webdevel  webmaster  security  configfile  configuration  solution  dammitbrain 
may 2018 by kme
Change Apache httpd "Server:" HTTP header - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
I simply changed the directives in security.conf and Apache started working as I wanted.
<code class="language-apache">
ServerTokens Prod
ServerSignature Off
</code>
webmaster  apache  httpd  config  configfile  security  configuration  solution  dammitbrain 
may 2018 by kme
numpy - Automatically import modules when entering the python or ipython interpreter - Stack Overflow | https://stackoverflow.com/
Use the environment variable PYTHONSTARTUP. From the official documentation:
If this is the name of a readable file, the Python commands in that file are executed before the first prompt is displayed in interactive mode. The file is executed in the same namespace where interactive commands are executed so that objects defined or imported in it can be used without qualification in the interactive session.

python  ipython  ptpython  startup  configfile  solution 
may 2018 by kme
MySQL :: MySQL 8.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program | https://dev.mysql.com/
The "options file handling" options need to come *first* on the command line, otherwise you get an error like what's described in this bug report[1] like "mysql: unknown variable 'defaults-group-suffix=:whatever'"

[1] https://bugs.mysql.com/bug.php?id=19611
dba  sysadmin  mysql  mysqldump  configfile  optionsfile  tipsandtricks  errormessage  solution 
may 2018 by kme
Manual:Short URL/Apache - MediaWiki | https://www.mediawiki.org/
In the Apache config (for the vhost or whatever):
<code class="language-apache">## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

# Enable the rewrite engine
RewriteEngine On

# Short URL for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
</code>

In 'LocalSettings.php':
<code class="language-php">
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/w"; // this should already have been configured this way
$wgArticlePath = "/wiki/$1";
</code>
mediawiki  essential  movein  shorturl  configfile  webmaster  apache  solution 
may 2018 by kme
vagrantfile - Print message after booting vagrant machine with "vagrant up" - Stack Overflow | https://stackoverflow.com/
Vagrant now has builtin support for a message to appear after vagrant up. Just add this to your Vagrantfile:

<code class="language-ruby">config.vm.post_up_message = "This is the start up message!"</code>

And then after your VM has come up you'll see this message in green:

<code>==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default: This is the start up message!</code>
vagrant  vagrantfile  provisioning  configfile  solution 
may 2018 by kme
yourls_allow_duplicate_longurls where to set it to allow · Issue #2186 · YOURLS/YOURLS · GitHub | https://github.com/
File: user/config-sample.php:49

<code class="language-php">/** Allow multiple short URLs for a same long URL
** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
define( 'YOURLS_UNIQUE_URLS', true );</code>

Set it to false in your config file.
php  yourls  configfile  configsetting  solution 
april 2018 by kme
dual boot - How to get grub2 to remember last choice? - Ask Ubuntu - https://askubuntu.com/
The documentation in this case is wrong. All variables in /etc/default/grub start with GRUB_, so it's GRUB_DEFAULT=saved, not DEFAULT=saved. I've corrected the Ubuntu wiki to reflect that.

The official grub manual describes this correctly: http://www.gnu.org/software/grub/manual/grub.html#Simple-configuration

Put the following in /etc/default/grub:
<code class="language-bash">
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
</code>

Then run:
<code class="language-bash">
sudo update-grub
</code>
linux  windows  grub  grub2  dualboot  bootmanager  configfile  configsetting  dammitbrain  solution 
march 2018 by kme
python - Booleans in ConfigParser always return True - Stack Overflow | https://stackoverflow.com/
Use getboolean():

<code class="language-python">print config.getboolean('main', 'some_boolean')
print config.getboolean('main', 'some_other_boolean')</code>

From the Python manual:

RawConfigParser.getboolean(section, option)

A convenience method which coerces the option in the specified section to a Boolean value. Note that the accepted values for the option are "1", "yes", "true", and "on", which cause this method to return True, and "0", "no", "false", and "off", which cause it to return False. These string values are checked in a case-insensitive manner. Any other value will cause it to raise ValueError.
python  webdevel  configfile  configparser  solution 
february 2018 by kme
How can I shortern my command line prompt's current directory?
It doesn't work on OSX with bash as shipped from Apple (I'm on Mountain Lion). The shipped version is 3.2.48(1)-release. If you install the latest bash using something like Homebrew, you'll get something in the neighborhood of 4.2.45(2)-release, which does support PROMPT_DIRTRIM.
Downside: It depends on the directory level, not the length of the path, which you might not want.

Upside: It's very simple. Just add export PROMPT_DIRTRIM=2 to your .bashrc.
bash  promptstring  bashrc  configfile  tipsandtricks  movein  solution 
december 2017 by kme
mysql - Why don't my .my.cnf settings work? - Database Administrators Stack Exchange | https://dba.stackexchange.com/
So after a bit of research, I found this link (http://datacharmer.blogspot.com/2011/03/hidden-options-file-trick.html) and came up with the following ~/.my.cnf that worked for me:

<code>
[clientdbid]
password = mypass
database = dbname
host = server.location.com
</code>

and the command that reads it:

<code class="language-bash">
mysql --defaults-group-suffix=dbid
</code>

A couple things to point out (highlights from the article linked):

* group has to be preceded by 'client' to be read by mysql

* has to go after any [client] groups, otherwise it will be overridden
dba  mysql  configfile  tipsandtricks 
december 2017 by kme
Enable Tab Completion for SSH Aliases
Blog formatting gremlins ate a bunch of extra backlashes, so you can't just copy-and-paste. The correct version with the missing backslashes is:

<code class="language-bash">
complete -o default -o nospace -W \
"$(/usr/bin/env ruby -ne 'puts $_.split(/[,\s]+/)[1..-1].reject{|host| host.match(/\*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" \
scp sftp ssh
</code>
bash  essential  movein  ssh  configfile  tabcompletion  bashcompletion  solution 
december 2017 by kme
Alternative way to clear search · Issue #131 · tpope/vim-sensible
I like mapping to <CR> because I can still use <Ctrl>+L for vim-tmux-navigator, but I prefer Tim's way of clearing the search, because you can still use n/N to pick up where you left off, after clearing the highlighting.

<code class="language-vim">
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
</code>
I don't know where I found this but I did quite some research on the topic and it turns out the best way is to do:

<code class="language-vim">
nnoremap <CR> :let @/ = "" <bar> echo "search string cleared whatever" <CR>
</code>

This being if you want the mapping to be on Enter, which I find really useful

I can't back this up with anything except that it works and doesn't break anything else, but I thought it would be useful.
searching  vim  configfile  tipsandtricks  movein  solution 
december 2017 by kme
Suggestion: set synmaxcol to sane levels · Issue #142 · tpope/vim-sensible
Hey, just wanted to suggest setting synmaxcol to a sensible level, it's 3000 by default!, and this makes no sense.

I learned of it while talking on #vim how editing an HTML with minified CSS line completely slowed everything down. As it's not sane to have human content reach this limit, I think bringing this value down to 300 or something is better than having it at 3000.
vim  tipsandtricks  configfile  syntaxhighlighting 
december 2017 by kme
systemd for Administrators, Part III
So, let's jump right in. As an example we'll convert the init script of the ABRT daemon into a systemd service file. ABRT is a standard component of every Fedora install, and is an acronym for Automatic Bug Reporting Tool, which pretty much describes what it does, i.e. it is a service for collecting crash dumps. Its SysV script I have uploaded here.

Here's what I came up with for a Sinatra Rack app:

<code>
[Unit]
Description=Run manservant on port 9292
# source: http://0pointer.de/public/systemd-man/systemd.special.html
After=network.target

[Service]
;User=ern6xv
ExecStart=/usr/local/bin/rackup
Type=simple
Restart=on-abnormal
WorkingDirectory=/home/ern6xv/devel/developer/manservant

[Install]
WantedBy=multi-user.target
</code>

With the help of these references:

- http://0pointer.de/public/systemd-man/systemd.service.html
- http://0pointer.de/public/systemd-man/systemd.exec.html
- http://0pointer.de/public/systemd-man/systemd.exec.html
systemd  initsystem  sysadmin  tutorial  configfile  sortof  solution 
december 2017 by kme
6.12. pam_issue - add issue file to user prompt
Yeah, but in elementaryOS Luna, the pam.d/login thing mentioned in the README.Debian doesn't work. You have to edit /etc/init/ttyX.conf, and add '-f /etc/issue.linuxlogo' to each "getty" invocation.
debian  ubuntu  elementaryos  elementary  console  eyecandy  configfile  workaround  maybe  solution 
december 2017 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read