recentpopularlog in

kme : solution   3021

« earlier  
UTF8, MySQL, Perl and PHP (Phil Gyford: Writing)
Only these two together seemed to work for me (CentOS 7, using vendor-supplied perl-DBD-MySQL-4.023-6.el7.x86_64):

<code class="language-perl">$dbh->{'mysql_enable_utf8'} = 1;
$dbh->do('SET NAMES utf8');</code>

The error message I would get otherwise was
SQL execution failed: COLLATION 'utf8_bin' is not valid for CHARACTER SET 'latin1' (1253)


Even if the table, server, column, collation were all 'utf8'. The *client* was the missing part, and 'SET NAMES utf8' fixes that, seemingly.
perl  dbd  dbi  database  errormessage  devel  solution 
1 hour ago by kme
DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI) - metacpan.org
Additionally, turning on this flag tells MySQL that incoming data should be treated as UTF-8. This will only take effect if used as part of the call to connect(). If you turn the flag on after connecting, you will need to issue the command SET NAMES utf8 to get the same effect.


This did *not* work as advertised, and I ended up setting it *after* the connect, along with 'SET NAMES', which actually *did* seem to fix the error messages I was getting about "COLLATION 'utf8_bin' is not valid for CHARACTER SET 'latin1'":

<code class="language-perl"># source https://www.gyford.com/phil/writing/2008/04/25/utf8-mysql-perl/
# see also: https://stackoverflow.com/a/6423280/785213
$dbh->{mysql_enable_utf8} = 1;
# $dbh->do('SET NAMES utf8');</code>
perl  dbi  dbd  mysql  dba  devel  reference  errormessage  workaround  solution 
1 hour ago by kme
SSH tunnelling for fun and profit: Autossh
<code class="language-bash">autossh -M 0 -f -T -N cli-mysql-tunnel</code>
automation  ssh  sshtunnelling  vpn  remoteaccess  reference  solution 
17 hours ago by kme
tmux windows and pane split's on current directory (Example)
Apparently this behavior changed in 1.9, but the link to the changelog in this article is broken.

<code>bind-key c new-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"</code>
tmux  movein  config  dotfile  fuckina  solution 
yesterday by kme
Programmable Completion (Bash Reference Manual)
Finally, any prefix and suffix specified with the -P and -S options are added to each member of the completion list, and the result is returned to the Readline completion code as the list of possible completions.


See
bash  completion  tabcompletion  programmablecompletion  shellscripting  solution 
3 days ago by kme
An introduction to bash completion: part 2
I created a script and I use bash_completion, but I cannot figure out how to allow the completion of "--name=value1 --name=value2" (the "=" sign in the middle stop any other completion, and I tried to play with suffixes/prefixes without any success :s


This works:

<code class="language-bash">case "$cur" in
-t*)
cur=${cur/-t}
COMPREPLY=( $(compgen -W "${_tables[*]}" -P "-t" \
-- "$cur" ) )
return 0
;;
--table=*)
cur=${cur/--table=}
COMPREPLY=( $(compgen -W "${_tables[*]}" -P "--table=" \
-- "$cur" ) )
return
;;
*)
COMPREPLY=( $(compgen -W "${_opts[*]}" -- "$cur") )
return
;;
esac</code>
bash  programmablecompletion  tabcompletion  shellscripting  fuckina  solution 
3 days ago by kme
bash - Wildcard expansion (globbing) in a string composed of quoted and unquoted parts - Stack Overflow
I had a variable that I was doing a regex comparison on within a Bash '[[ ]]' conditional that could /sometimes/ have the value of '*'; quoting didn't seem to help, but 'set -f' did.
bash  shellscripting  globbing  fileglobs  globs  workaround  solution 
5 days ago by kme
How Can I Sort A 'Version Number' Column Generically Using a SQL Server Query - Stack Overflow
For sorting by chromosome then start coordinate, I used:

<code class="language-sql">SELECT [...]
ORDER BY SUBSTRING(chr from 4) + 0 ASC, start</code>
sql  dba  mysql  solution 
5 days ago by kme
Issue 31652: make install fails: no module _ctypes - Python tracker
Had to build and install libffi into the PREFIX for Python-3.7.4 when building it from source on CentOS 7.

See also: https://bugs.python.org/issue34036
centos  centos7  fromsource  build  toolchain  compiler  errormessage  python  workaround  solution 
7 days ago by kme
Autoconf, Libtool, and an undefined AC_PROG_LIBTOOL - Super User
This fixed this for me—modifying the supplied 'autogen.sh', so that it ran this command instead:
<code class="language-bash">autoreconf -v -f -i -I /usr/share/aclocal</code>
To fix this if you already have a /usr/local/share/aclocal directory, type the following as root:
<code class="language-bash">for file in argz libtool ltdl ltoptions ltsugar ltversion lt~obsolete
do
ln -s /usr/share/aclocal/$file.m4 /usr/local/share/aclocal/$file.m4
done
</code>

To fix this if you don't have a /usr/local/share/aclocal directory, type the following as root:
<code class="language-bash">ln -s /usr/share/aclocal /usr/local/share/aclocal</code>

Voilà -- problem solved.
autoconf  errormessage  build  toolchain  centos7  annoyance  solution 
7 days ago by kme
Debug Tool Window. Console - Help | PyCharm
The "Show Python prompt" button is not available if you set "Emulate terminal in output console" in the configuration for the current debug profile (ref: https://www.jetbrains.com/help/pycharm/2018.1/run-debug-configuration-python.html)
pycharm  debugging  annoyance  solution 
16 days ago by kme
How Do I Turn Off The Magic Trackpad?


The Magic Trackpad power button is hidden on the right side of the device. Press the button until a message appears at the bottom of your screen confirming the Magic Trackpad has been powered down.
mac  hardware  bluetooth  magictrackpad  solution 
18 days ago by kme
macOS FAQ - WineHQ Wiki | https://wiki.winehq.org/
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
wine  font  rendering  freetype  smoothing  fontsmoothing  cleartype  sortof  solution  linux  mac  osx  macos 
21 days ago by kme
Wine - Debian Wiki | https://wiki.debian.org/
wine 1.6.2-20 packages in Debian Jessie - To use the wine-wrapper scripts such as winecfg, wineboot or regedit you have to set them as an option to the command "wine". See Debian bug #784280. wine-development and later wine versions are are not affected. E.g. typing only "winecfg" will cause an error if no wineprefix exists yet, while "wine winecfg" works as expected.
wine  debian  winecfg  configuration  controlpanel  solution 
21 days ago by kme
python - What is the global default timeout - Stack Overflow | https://stackoverflow.com/
The answer is it's compiled into the kernel. Just use the 'timeout=' parameter to urlllib.request.urlopen if you're tired of waiting.
python  webdevel  timeout  urllib  sortof  solution 
22 days ago by kme
xorg - how to type “smart quotes” (U+201C, U+201D) - Unix & Linux Stack Exchange | https://unix.stackexchange.com/


With a Compose key:

Compose , " → „
Compose < " → “
Compose > " → ”
Compose < ' → ‘
Compose > ' → ’

You can enter the last two characters in either order, at least in most locales. There may be locales where it only works in the order Compose < " works or only in the order Compose " <.

If you need to press Shift or AltGr to enter some of these characters, you'll need to hold those modifiers down as usual. You can press and release Compose before the subsequent characters, or you can press Compose and keep it down, as you prefer.

Most keyboards don't have a key marked “Compose”, but you can configure one and your environment may already have one configured. On a PC, a popular choice is the “Menu” key between the right Windows key and the right Ctrl key. The keyboard settings of most desktop environment include an option to make this key or some other key a Compose key.
linux  x11  composekey  curlyquotes  quotes  specialcharacters  hotkey  solution 
26 days ago by kme
How to Check CentOS Version Number
<code class="language-bash">cat /etc/centos-release</code>
sysadmin  centos  release  solution 
27 days ago by kme
python - UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128) - Stack Overflow | https://stackoverflow.com/
So, even if your format string is Unicode, you *still* need to encode it?

Weird.

<code class="language-python">
print(u"{}\u00a0{}\u00a0{}\u00a0".format('non', 'breaking', 'spaces').encode.('utf-8'))
</code>
This is a classic python unicode pain point! Consider the following:
<code>
a = u'bats\u00E0'
print a
=> batsà
</code>

All good so far, but if we call str(a), let's see what happens:
<code>
str(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 4: ordinal not in range(128)
</code>

Oh dip, that's not gonna do anyone any good! To fix the error, encode the bytes explicitly with .encode and tell python what codec to use:
<code>
a.encode('utf-8')
=> 'bats\xc3\xa0'
print a.encode('utf-8')
=> batsà
</code>
python  unicode  stringconcatenation  encoding  utf8  solution  reference 
27 days ago by kme
perlfaq4 - Data Manipulation - metacpan.org | https://metacpan.org/
How do I determine whether a scalar is a number/whole/integer/float?

Assuming that you don't care about IEEE notations like "NaN" or "Infinity", you probably just want to use a regular expression (see also perlretut and perlre):
<code class="language-perl">
use 5.010;

if ( /\D/ )
{ say "\thas nondigits"; }
if ( /^\d+\z/ )
{ say "\tis a whole number"; }
if ( /^-?\d+\z/ )
{ say "\tis an integer"; }
if ( /^[+-]?\d+\z/ )
{ say "\tis a +/- integer"; }
if ( /^-?(?:\d+\.?|\.\d)\d*\z/ )
{ say "\tis a real number"; }
if ( /^[+-]?(?=\.?\d)\d*\.?\d*(?:e[+-]?\d+)?\z/i )
{ say "\tis a C float" }
</code>

There are also some commonly used modules for the task. Scalar::Util (distributed with 5.8) provides access to perl's internal function looks_like_number for determining whether a variable looks like a number. Data::Types exports functions that validate data types using both the above and other regular expressions. Thirdly, there is Regexp::Common which has regular expressions to match various types of numbers. Those three modules are available from the CPAN.
perl  validation  regex  regexp  solution 
4 weeks ago by kme
Re: Lua and pkg-config .pc file | http://lua-users.org/
I was trying to build 'highlight' (https://gitlab.com/saalen/highlight) and got a 'lua.pc' not found error. This was the solution

<code class="language-bash">
make pc INSTALL_TOP=/wherever/you/stow/lua-5.3.5 > lua.pc
</code>

This was just an off-the-cuff answer from someone who probably doesn't know 'pkg-config' very well, though, because it *still* doesn't work unless you add 'Name:', 'Version:', and 'Description:' fields to the .pc file.

THEN, you can move that 'lua.pc' into '/wherever/you/stow/lua-5.3.5/lib/pkgconfig' and update the PKG_CONFIG_PATH environment variable.
lua  build  toolchain  errormessage  library  pkg-config  annoyance  workaround  solution 
4 weeks ago by kme
How to change language settings in R - Stack Overflow
<code class="language-r">
> Sys.setenv(LANG = "fr")
> 2 + x
Erreur : objet 'x' introuvable
> Sys.setenv(LANG = "en")
> 2 + x
Error: object 'x' not found
</code>
r  localization  i18n  languagesetting  solution 
5 weeks ago by kme
Linux command line character limit - Server Fault
The shell/OS imposed limit is generally very long - usually one or two hundred thousand characters.
<code class="language-bash">getconf ARG_MAX</code>

will give you the maximum input limit for a command. On the Debian system I currently have a terminal open on this returns 131072 which is 128*1024. The limit is reduced by your environment variables as if my memory serves me correctly these are passed in the same structure by the shell, though that will only take off a few hundred characters in most cases. To find an approximation of this value run env | wc -c - this suggests 325 characters at the current time on this login on this machine.

Scripts are likely to permit this full length, but it is not unlikely that other utilities will impose their own limits either intentionally or through design issues. There may also be artificial limits to how long an individual argument on a long command line can be, and/or how long a path to a file can be.
linux  shell  environmentsize  commandline  solution 
5 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 
5 weeks ago 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 
5 weeks ago by kme
Table of Contents Everywhere
This one is good.
On pages which do not have a Table of Contents, but should do, create one! (I actually use this as a bookmarklet, so I can load it onto the current page only when I want it.)
userscript  javascript  bookmarklet  toc  tableofcontents  solution 
5 weeks ago by kme
stdout - How to make output of any shell command unbuffered? - Stack Overflow


Try stdbuf, included in GNU coreutils and thus virtually any Linux distro. This sets the buffer length for input, output and error to zero:
<code class="language-bash">stdbuf -i0 -o0 -e0 command</code>


This totally works for something like this:
<code class="language-bash">stdbuf -i0 -o0 -e0 find . -name 'core*' -printf '%f\t%s\n' | head</code>
bash  shellscripting  pipes  unix  buffering  solution 
5 weeks ago by kme
macos - How to remove the scrollbar in Terminal.app on Mac OS X 10.6? - Super User
Go to System Preferences -> General and change Show scroll bars to When scrolling.
macos  mac  osx  terminal.app  scrollbars  annoyance  preference  solution 
6 weeks ago by kme
Install R with MacPorts – John Laudun
However, you run into dependency hell with 'libgcc'.

<code class="language-bash">port search --exact R</code>
mac  osx  macos  macports  r  sortof  solution 
6 weeks ago 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 
6 weeks ago by kme
Failure while executing git config, exit code 129 · Issue #921 · Linuxbrew/brew
<code class="language-bash">export HOMEBREW_GIT_PATH=$HOME/bin/git
export HOMEBREW_NO_ENV_FILTERING=1</code>
homebrew  hpc  cluster  errormessage  solution 
7 weeks ago by kme
linux - Bash arrays and negative subscripts, yes or no? - Stack Overflow
This is *way* easier than stuff I was trying to do before. The reason this doesn't show up in the help for "Arrays" in the bash manual is because it's a type of "Shell Parameter Expansion" that just happens to behave the way it does when the subscripted thing is an array.
If you just want the last element
<code class="language-bash">$ echo ${muh[*]: -1}
2</code>

If you want next to last element
<code class="language-bash">$ echo ${muh[*]: -2:1}
bleh</code>
bash  shellscripting  arrays  subscripting  syntax  fuckina  solution 
7 weeks ago by kme
unix - ImageMagick - how to enforce min/max heights/widths? - Stack Overflow
The short answer is basically just do '200x200' and both dimensions will be reduced to no more than 200 pixels, preserving the aspect ratio.

The '-geometry' option has some weird ways of doing what seems like the same thing, like '^' and '>'; see https://www.imagemagick.org/script/command-line-processing.php#geometry.
imagemagick  commandline  imageprocessing  sortof  solution 
7 weeks ago by kme
ExifTool FAQ
By default, ExifTool applies a print conversion (PrintConv) to extracted information to make the output more human-readable. Some conversions involve lookup tables which are documented in the Values column of the tag name documentation. For example, the GPSAltitudeRef tag defines the following conversions:
0 = Above Sea Level
1 = Below Sea Level


For this tag, a value of '0' is printed as 'Above Sea Level', and '1' is printed as 'Below Sea Level'. Reading and writing with ExifTool is symmetrical [with the possible exception of list-type tags -- see FAQ number 17 below], so a value that is printed as 'Above Sea Level' must also be written in that form. (In other words, the inverse print conversion is applied when writing values.) For example, to write GPSAltitudeRef you can type:
<code class="language-bash">exiftool -gpsaltituderef="Above Sea Level" image.jpg</code>

or any unambiguous short form may be used and ExifTool will know what you mean, eg)
<code class="language-bash">exiftool -gpsaltituderef=above image.jpg</code>

Alternatively, the print conversion can be disabled for all tags with the -n option, or for individual tags by suffixing the tag name with a '#' character. In either case the printed value of GPSAltitudeRef will be '0' or '1' when extracting information, and the value is written in the same way. So following two commands have exactly the same effect as above:
<code class="language-bash">exiftool -gpsaltituderef=0 -n image.jpg
exiftool -gpsaltituderef#=0 image.jpg</code>
exiftool  errormessage  gps  geo  exif  jpeg  jpg  solution 
8 weeks ago by kme
Copy GPS coord tags - Wrong Hemisphere!
Add -g1 to last command to see the source of the various GPS tags.


This didn't actually help me; what helped was including *all* the tags that had to do with GPS, except the time/datestamps. I came up with this Bash function to help

<code class="language-bash"># copy EXIF GPS info including altitude from one file to another
exif_gps_from_to() {
exiftool -n -tagsFromFile "$1"\
-GPSVersionID \
-GPSLatitudeRef \
-GPSLongitudeRef \
-GPSAltitudeRef \
-GPSAltitude \
-GPSLongitude \
-GPSLatitude \
-GPSPosition \
"$2"
}
</code>
exif  jpg  jpeg  imageprocessing  gps  geo  exiftool  commandline  solution 
8 weeks ago by kme
How to add GPS (geolocation) tags to photos — Robert Zaremba blog
% exiftool -GPSLongitude="14.273586" -GPSLatitude="50.860361" img.png
geo  gps  jpg  exif  imageprocessing  commandline  exiftool  solution 
8 weeks ago by kme
bash - unshift args after calling shift 1 - Unix & Linux Stack Exchange
You never need to use shift 1 in the first place. Just use the positional arguments and slice around their indices to pass the arguments.
<code class="language-bash">first_arg="$1"</code>

Once you do this, the rest of the arguments can be accessed as "${@:2}". The notation is a way to represent from positional argument 2 to till the end of the list.
bash  shellscripting  positionalarguments  parameters  solution 
8 weeks ago by kme
Don't write "ignore-file" unless the content actually changes by mdshw5 · Pull Request #303 · rstudio/packrat
This clued me in to the fact that yes, the Shiny application *did* need to write to the '.gitignore' because of something to do with Packrat.
shinyserver  shiny  errormessage  packrat  gitignore  solution 
9 weeks ago 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 
9 weeks ago by kme
git - Why should I care about lightweight vs. annotated tags? - Stack Overflow
@Chris yes, as the answer says, "The big plus of an annotated tag is that you know who created it." You can always try things yourself to find out: git tag -a -m 'my message' my-tag; git show my-tag – Cascabel Aug 9 '17 at 16:17


Note, though, that '-a' is implied when '-m' is given.
git  tags  annotatedtags  thisvsthat  lightweighttags  release  solution 
9 weeks ago by kme
python - Setuptools "development" Requirements - Stack Overflow
So using
<code class="language-python">setup({
install_requires=requirements,
extras_require={
'dev': [
'pytest',
'pytest-pep8',
'pytest-cov'
]
}
})</code>

And then
<code class="language-bash">pip install -e .[dev]</code>

seems to be best practice.
python  setuptools  packaging  virtualenv  solution  bestpractice 
9 weeks ago by kme
URL Encode and Decode - Online
This one will encode things like parentheses, which DuckDuckGo just leaves unescaped.
encoding  percentencoding  urlencode  webapp  webdevel  solution 
9 weeks ago by kme
python - How can I get the version defined in setup.py (setuptools) in my package? - Stack Overflow
<code class="language-python">import pkg_resources # part of setuptools
version = pkg_resources.require("MyProject")[0].version</code>
python  setuptools  packaging  solution 
9 weeks ago by kme
How do you attach and detach from Docker's process? - Stack Overflow
To detach the tty without exiting the shell, use the escape sequence Ctrl-p Ctrl-q.

more details here: https://docs.docker.com/engine/reference/commandline/attach/

additional info from this source (https://groups.google.com/forum/#!msg/docker-user/nWXAnyLP9-M/kbv-FZpF4rUJ):

* docker run -t -i → can be detached with ^P^Qand reattached with docker attach
* docker run -i → cannot be detached with ^P^Q; will disrupt stdin
* docker run → cannot be detached with ^P^Q; can SIGKILL client; can reattach with docker attach
docker  commandline  tipsandtricks  solution  fuckina 
9 weeks ago by kme
Docker and Locales
Like, in my case, Vim wasn't displaying UTF-8 encoded symbols (like "»") correctly.

Here's his working Dockerfile recipe:
<code>FROM ubuntu:13.10

# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
</code>
docker  locale  characterencoding  errormessage  annoyance  solution 
9 weeks ago by kme
How to Set Up System Locale on CentOS 7 | RoseHosting
I think 'localectl' is not built into the base CentOS 7 OS or something? Or at least not the Docker image? Because, sure enough, it wasn't there before, and after a 'yum update' it is.

For a CentOS 7 Docker image, however, you still need to 'yum reinstall -y glibc-common' and just set 'LC_ALL' or 'LANG' in your environment; the 'localectl' command won't work because there's no D-Bus daemon running on the Docker image.
centos  locale  language  sysadmin  sortof  solution  docker 
9 weeks ago by kme
windows - How to fix PuTTY showing garbled characters? - Server Fault
The analogous fix on CentOS (7) is to use 'localectl', maybe, except that requires DBus to be running, which it isn't for a fresh-out-of-the-box Docker container. ¯\_(ツ)_/¯
If the locale returns something like POSIX, issue
<code class="language-bash">update-locale LANG=en_US.utf8</code>
at the command line - see thomas-krenn.com/de/wiki/Locales_unter_Ubuntu_konfigurieren – koppor Dec 19 '15 at 11:05
docker  utf8  characterencoding  locale  mojibake  terminal  unix  shell  ubuntu  solution  centos  sortof 
9 weeks ago by kme
css3 - How can I transition height: 0; to height: auto; using CSS? - Stack Overflow
Use max-height in the transformation and not height. And set a value on max-height to something bigger than your box will ever get.
css  animation  css3  transitions  webdesign  dammitbrain  solution 
10 weeks ago by kme
Force flushing of output to a file while bash script is still running - Stack Overflow
I found a solution to this here. Using the OP's example you basically run
<code class="language-bash">stdbuf -oL /homedir/MyScript &> some_log.log</code>

and then the buffer gets flushed after each line of output. I often combine this with nohup to run long jobs on a remote machine.
<code class="language-bash">stdbuf -oL nohup /homedir/MyScript &> some_log.log</code>

This way your process doesn't get cancelled when you log out.
bash  shellscripting  buffering  annoyance  workaround  solution 
10 weeks ago by kme
linux - bash + arithmetic calculation with bash - Unix & Linux Stack Exchange
Since arithmetic expansion only does integer division, the proposed answer uses AWK, passing in values as variables, with '/dev/null' as the input file, and the math in a 'BEGIN' block.
bash  awk  shellscripting  floatingpoint  math  tipsandtricks  solution 
10 weeks ago by kme
How to View a Certificate Fingerprint as SHA-256, SHA-1 or MD5 using OpenSSL
How to View a Certificate Thumbprint as SHA-256, SHA-1 or MD5 using OpenSSL How to View a Certificate Fingerprint as SHA-256, SHA-1 or MD5 using OpenSSL
openssl  x509  crypto  ssl  certificate  sha1  sha256  hash  fingerprint  commandline  solution 
10 weeks ago by kme
arrays - Perl: if ( element in list ) - Stack Overflow
Here is an example which works with any searched (scalar) value, including undef:
<code class="language-perl">use List::MoreUtils qw(any);

my $value = 'test'; # or any other scalar
my @array = (1, 2, undef, 'test', 5, 6);

no warnings 'uninitialized';

if ( any { $_ eq $value } @array ) {
print "$value present\n"
}</code>
perl  listmembership  lists  syntax  newbie  dammitbrain  likepython  solution 
11 weeks ago by kme
Optional Features - NeoMutt
Try
set imap_authenticators="login"

when working with DavMail
davmail  mutt  imap  mua  email  configsettings  solution 
11 weeks ago by kme
log4j Logging Levels
log4j Logging Levels - Learn how log4j framework works starting from environment setup, logging levels, methods, formatting, methods, file logging and database logging.
java  logging  davmail  solution 
11 weeks ago by kme
r - Does packrat work on shiny server? - Stack Overflow
The answer is "yes"; 'packrat::init(".")' will install all the libraries necessary for your project AND append to your .gitignore
r  shiny  shinyserver  packrat  dependencymanagement  packagemangement  solution 
11 weeks ago by kme
Using R with git and packrat - Stack Overflow
packrat::init(".") actually appends to your .gitignore nowadays.
r  dependencymanagement  packagemangement  packrat  git  gitignore  solution 
11 weeks ago by kme
unix - tar – extract discarding directory structure - Super User | https://superuser.com/
If you just want to remove a few path segments, then --strip-components=n or --strip=n will often do:
<code class="language-bash">
tar xvzf tgz --strip=1
</code>
unix  linux  sysadmin  tar  archive  backupandrecovery  solution 
12 weeks ago by kme
Python - simple reading lines from a pipe - Stack Overflow
This is sufficient:
<code class="language-python">line = sys.stdin.readline()</code>

Use 'python's '-u' command line option or sys.stdout.flush() if you have buffering problems; stdout is always buffered.

See also: https://youtu.be/XvDZLjaCJuw?t=800 (talking calculator from 1982)
python  io  pipes  pipelining  standardinput  stdin  solution 
may 2019 by kme
How do I tell Python to convert integers into words - Stack Overflow
See also: https://youtu.be/XvDZLjaCJuw?t=800 (UNIX demo from 1982)
The inflect package can do this.

https://pypi.python.org/pypi/inflect
<code class="language-bash">$ pip install inflect</code>

and then:
<code class="language-python">>>>import inflect
>>>p = inflect.engine()
>>>p.number_to_words(99)
ninety-nine</code>
python  english  numbers  texttospeech  tts  solution 
may 2019 by kme
Ayatana indicator has dissapeared (again) from Juno : elementaryos | https://www.reddit.com/
Ok, I found the solution: it was enough to re-edit /etc/xdg/autostart/indicator-application.desktop:
<code class="language-bash">sudo nano /etc/xdg/autostart/indicator-application.desktop</code>

change again:

<code>OnlyShowIn=Unity;GNOME;</code>

to

<code>OnlyShowIn=Unity;GNOME;Pantheon;</code>

and reboot.


Also:
If you copy the file to .config/autostart/indicator-application.desktop then you shouldn't have to worry about it getting overwritten again.
elementaryos  juno  appindicator  panelindicators  systemtray  systray  fuckina  solution 
may 2019 by kme
Big gap between icons · Issue #1 · mdh34/elementary-indicators | https://github.com/
Still works in 5.0 Juno.
Try setting the padding to '0 2px' in your theme -> apps.css

In my case I use https://github.com/surajmandalcell/elementary-x :
/usr/share/themes/elementary-x/gtk-3.22/apps.css
<code class="language-css">.composited-indicator {
padding: 0 2px;
}</code>

Then set your theme to something else and then back again to make sure the changes are refreshed(or restart/log out)
elementaryos  juno  panelindicator  appindicators  annoyance  solution 
may 2019 by kme
Unwanted context menu behaviour after update to Firefox 61.0 - Right clicks are automatically double clicking : firefox | https://www.reddit.com/
After some trial-and-error I was able to fix the issue in about:config by toggling ui.context_menus.after_mouseup to true. The default is false. I believe this may have something to do with the fact that I'd previously toggled dom.event.contextmenu.enabled to false to always allow for the context menu, even if a site disables it.
firefox  nightly  contextmenu  annoyance  solution 
may 2019 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read