recentpopularlog in
« earlier   later »
Liam O 🦆 on Twitter: "Favourite thing in my .bashrc remains: alias fuck='sudo $(history -p !!)'"
Also note that this will (probably) not work with quoted arguments.
<code class="language-bash">
alias fuck='sudo $(history -p !!)'
unix  linux  sysadmin  sudo  bashrc  fuckups  humor 
december 2019
Automatic App Deployment with "git push" - Benjamin Gleitzman's Blog
When deploying pet projects on remote servers, I dislike the extra step of logging into the remote machine to execute a git pull (and perhaps a server reload) every time I push new code. Sure there’s Jenkins and all sorts of bazooka-like solutions, but this is a knife fight. Poking around an old PHP repo, I found a nifty line of code that will update your app via a URL endpoint.
<code class="language-bash"><?php `git pull`;</code>
Drop that into secret-update-url.php and now all you have to do is visit to get the latest version of your code on the site. Going a step further, you can set up a webhook to have Github hit the URL for you.
webdevel  git  php  deployment  automation  python  flask 
december 2019
javascript - Remove All Event Listeners of Specific Type - Stack Overflow
I ended up binding to 'window.onscroll' and just set 'document.documentElement.scrollTop = 0' each time it fired, which is janky when there are a ton of scroll events queued.

But nothing else--neither 'e.preventDefault()' nor 'e.stopPropagation()'--seemd to work.
webdevel  javascript  eventhandler  mousewheel  scrolling  sortof  workaround  solution 
december 2019
Creating a package.json file | npm Documentation
<code class="language-json">{
"name": "my-awesome-package",
"version": "1.0.0"

<code class="language-bash">npm init</code>
webdevel  javascript  npm  packaging  dammitbrain  solution 
december 2019
Create Your Own Shortcodes | Hugo
Note: you can only use these in your content, *not* inside templates.
webdevel  hugo  shortcodes 
december 2019
URL Management | Hugo
It's better to use ':filename' for a permalink, since you could easily update the title in the YAML front matter and break existing URLs that you'd already shared with people (or had indexed by search engines).

<code class="language-toml">
post = "/:year/:month/:filename/"

If you've already set up your blog and had it running for a while, good luck creating redirects for all the pages whose titles have changed.
hugo  blog  permalink  config  essential  configfile  bestpractice 
december 2019
Custom Git subcommands - Sebastian Daschner
For my own projects, I wrote a script git-update which does a commit on all files with default or custom message, rebase-pull, and push:
<code class="language-bash">#!/bin/zsh
set -eu

branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')

pushd $(git rev-parse --show-toplevel || echo ".")
git add --all .
git commit -m "${message}" || true
git pull --rebase origin ${branch} || true
git push origin ${branch}
git  subcommand  customization  tipsandtricks 
december 2019
Difference between "Command substitution" and "Process substitution"
It's just a shame the first reply is "I do not know what you mean by 'process substitution'". Like, look it up and learn something, bro.

Also a shame that no one mentions it's Korn- and Bash-specific, although zsh probably has it, too.
unix  bash  korn  shell  shellscripting  processsubstitution  thisvsthat  commandsubstitution  newbie  explained 
december 2019
Firefox Bookmark Backup Reader/Decompressor — Fx File Utilities
Firefox creates frequent backups of your bookmarks. Automatic backups are compressed using Mozilla's flavor of LZ4 compression (.jsonlz4 file extension), while backups you create yourself (in the Library window) are not compressed (.json file extension by default). This tool can convert a backup file to the HTML export format.
firefox  bookmarks  json  jsonlz4  backupandrecovery  importexport  solution 
december 2019
Elasticsearch integration | GitLab
Note that you have to have a paid (at least "Starter") license for the Elasticsearch options to even show up in the Admin Area. It doesn't work to just stick some config options in /etc/gitlab/gitlab.rb and 'gitlab-ctl reconfigure'. :-(

<code class="language-bash"># Create empty indexes
sudo gitlab-rake gitlab:elastic:create_empty_index

# index personal snippets
sudo gitlab-rake gitlab:elastic:index_snippets
gitlab  gitlab-ee  elasticsearch  searchandindex  webmaster  sysadmin  solution 
december 2019
Elasticsearch settings in /etc/gitlab/gitlab.rb not used/mentioned/synced (#1581) · Issues · / GitLab · GitLab
You can't enable Elasticsearch just by putting these in /etc/gitlab/gitlab.rb. You actually have to have a ("Starter" or above) license.

<code class="language-ruby">## ElasticSearch (EE only)
# gitlab_rails['elasticsearch_enabled'] = false
# gitlab_rails['elasticsearch_host'] = "localhost"
# gitlab_rails['elasticsearch_port'] = 9200</code>
gitlab  elasticsearch  searchandindex  solution 
december 2019
ElasticSearch configuration via `gitlab.rb` (#3457) · Issues · / omnibus-gitlab · GitLab
Not a problem I have, just interesting. As of GitLab 12.5.something, you have to enable and configure Elasticsearch through the "Admin Area," and you have to have an active (paid) license.
gitlab  configuration  searchandindex  elasticsearch  interesting 
december 2019
Install Elasticsearch on CentOS 6.7 - Sysadmins of the North
<code class="language-bash"><code>sudo chkconfig --add elasticsearch</code>

I also had to:
<code class="language-bash">chmod g+ws /etc/elasticsearch/</code>
elasticsearch  installation  centos  centos6  solution 
december 2019
Install Elasticsearch with RPM | Elasticsearch Reference [7.5] | Elastic
An alternative package which contains only features that are available under the Apache 2.0 license is also available. To install it, use the following baseurl in your elasticsearch.repo file:

Not positive how fussy GitLab is about the *exact* version (it says 5.6 - 6.x here -, but unsurprisingly you can get Elasticsearch 6.x OSS packages with this 'baseurl' instead:
sysadmin  devops  centos  centos6  centos7  elasticsearch  rpm  installation  howto  reference  solution 
december 2019
Hardware | Elasticsearch: The Definitive Guide [2.x] | Elastic
A machine with 64 GB of RAM is the ideal sweet spot, but 32 GB and 16 GB machines are also common. Less than 8 GB tends to be counterproductive (you end up needing many, many small machines), and greater than 64 GB has problems that we will discuss in Heap: Sizing and Swapping.

Interesting node about the I/O scheduler used on a system with SSDs:
Check Your I/O Scheduler

If you are using SSDs, make sure your OS I/O scheduler is configured correctly. When you write data to disk, the I/O scheduler decides when that data is actually sent to the disk. The default under most *nix distributions is a scheduler called cfq (Completely Fair Queuing).

This scheduler allocates time slices to each process, and then optimizes the delivery of these various queues to the disk. It is optimized for spinning media: the nature of rotating platters means it is more efficient to write data to disk based on physical layout.

This is inefficient for SSD, however, since there are no spinning platters involved. Instead, deadline or noop should be used instead. The deadline scheduler optimizes based on how long writes have been pending, while noop is just a simple FIFO queue.

This simple change can have dramatic impacts. We’ve seen a 500-fold improvement to write throughput just by using the correct scheduler.
searchandindex  sysadmin  elasticsearch  architecture  systemrequirements  performance 
december 2019
GitLab Release and Maintenance Policy | GitLab
Under "Upgrade recommendations" they say upgrade to the latest point release, then do one minor release, *before* jumping major versions.

For example:
11.3.4 -> 11.11.8 -> 12.0.9 -> 12.5.8
gitlab  upgrade  migration  centos  solution 
december 2019
SKS Keyservers: Overview of the pools

This is a pool containing only servers available on port 80 (needs to be used as hkp://

This is a pool containing only servers available using hkps. Regular A and AAAA and SRV records are included for port 443 servers, and a lookup is performed for _pgpkey-https._tcp on the individual servers to determine if a hkps enabled service is listening on another port. At this point, however, servers not running on port 443 are not included.

This pool only include servers that have been certified by the CA, of which the certificate can be found at [OpenPGP signature] [CRL].

For GnuPG 1.4 and 2.0 installations this can be used by using the following parameters in gpg.conf:
<code class="language-ini"># ~/.gnupg/gpg.conf:
keyserver hkps://
keyserver-options ca-cert-file=/path/to/CA/sks-keyservers.netCA.pem

GnuPG 2.1 users prior to version 2.1.11 (starting with this version the certificate is enabled by default for this pool) want to add the following in dirmngr.conf:
<code class="language-ini"># ~/.gnupg/dirmngr.conf:
hkp-cacert /path/to/CA/sks-keyservers.netCA.pem

Keyserver operators wanting to be included in this pool will have to send an OpenPGP signed message containing a CSR to a UserID of 0x94CBAFDD30345109561835AA0B7F8B60E3EDFAE3.
gpg  keyserver  maybesolution  reference 
december 2019
Gitlab update to version from 10.* - Questions & Answers / Upgrade - GitLab Forum
This is exactly what says anyway.

However, there's this tidbit:
Upgrading to 12.0 is absolutely safe. We run extensive tests internally before releases are made available. 12.0 should bring some improvements and additional features/functionality.

For the smoothest possible experience, I would suggest following this sequential upgrade path: 10.8.7 -> 11.3.4 -> 11.11.4 -> 12.0.2

You can check that the upgrade was successful between versions with:

sudo gitlab-rake gitlab:check

If you have any problems, reply to this with any error messages and relevant info.
gitlab  upgrade  bestpractices 
december 2019
GitLab Release and Maintenance Policy | GitLab
They say upgrade to the latest point release before jumping major versions.
gitlab  upgrade 
december 2019
widgets - How do I remove the clock from the Ubuntu Budgie 18.04 desktop? - Ask Ubuntu
The clock is a budgie-desktop applet. Like other applets you can modify, add and remove applets from Budgie Settings.

Open Budgie Settings from the menu or Raven. Look at the list of applets in your Panel (Applets tab) and click on "Desktop time & date". You can the delete the applet.
ubuntu  budgie  desktopapplet  annoyance  solution 
december 2019
template - The Go Programming Language
A variable's scope extends to the "end" action of the control structure ("if", "with", or "range") in which it is declared, or to the end of the template if there is no such control structure. A template invocation does not inherit variables from the point of its invocation.
hugo  go  templates  documentation  webdevel  variables  scope 
december 2019
What’s New in Thunderbird 68 | The Mozilla Thunderbird Blog
So, um, no mention of all XPI extensions not working with this release?
whatsnew  thunderbird  tb68  webextensions 
december 2019
How do I stop sed from adding extra newline characters - Unix & Linux Stack Exchange
GNU sed, if it's available, will not print an extraneous newline if you do 'sed -n "s/patt/repl/p"' (source:
If you do need that file not to end in a newline character, then you could use perl or other tools that can cope with non-text data.
<code class="language-bash">perl -pe 's|<LIST_G_STATEMENT>|$&\n|g'</code>
perl  sed  newlines  textprocessing  unix  annoyance  solution 
december 2019
mchaput / whoosh / wiki / Home — Bitbucket
Whoosh is a fast, featureful full-text indexing and searching library implemented in pure Python. Programmers can use it to easily add search functionality to their applications and websites. Every part of how Whoosh works can be extended or replaced to meet your needs exactly.
python  fts  fulltextindex  searchandindex  purepython  library 
december 2019
display manager - How do I disable X at boot time so that the system boots in text mode? - Ask Ubuntu
<code class="language-bash">sudo systemctl enable --force
sudo systemctl set-default</code>
ubuntu  xubuntu  systemd  runlevel  init  maybesolution 
december 2019
How do you remap a key to the Caps Lock key in Xubuntu? - Ask Ubuntu
Another way:
<code class="language-bash">sudo vi /etc/default/keyboard</code>
then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control.

For example, mine looks like
code class="language-bash">XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"</code>
hen run
<code class="language-bash">sudo dpkg-reconfigure keyboard-configuration<code>
The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.
linux  ubuntu  xubuntu  swapcapslockandctrl  capslock  keymap  console  solution 
december 2019
How to Get CMake to Use Default Compiler on System PATH? - Stack Overflow
OK, so it's *not* ignoring $PATH, it's just prefering 'cc' and 'c++', which just happen to point to the OS-default compilers in /usr/bin, rather than the ones loaded by, say, 'module load gcc/8.1.0'.
CMake honors the setting of the PATH environment variable, but gives preference to the generic compiler names cc and c++. To determine which C compiler will be used by default under UNIX by CMake, run:
<code class="language-bash">$ which cc
To determine the default C++ compiler, run:
<code class="language-bash">$ which c++</code>
If you generate a symbolic link c++ in /opt/gcc-4.8/bin which points to /opt/gcc-4.8/bin/g++, CMake should use GCC 4.8 by default.
cmake  build  toolchain  annoyance  solution 
december 2019
linux - How to get CMake to use the default compiler on system PATH? - Stack Overflow
As is already written in the answer to the other question, CMake prefers the generic compiler names cc and c++ when searching for the C and C++ compilers. These probably refer to GNU version 4.1 compilers on your system.

Anyway, to force CMake to use the default compilers on the system path, add the following code to the beginning of your outermost CMakeLists.txt.
<code class="language-cmake">find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH)
project (Foo C CXX)</code>
The find_program calls must occur before the call to project or enable_language.
cmake  build  toolchain  annoyance  workaround 
december 2019
« earlier      later »
per page:    204080120160

Copy this bookmark:

to read