recentpopularlog in
« earlier   later »
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>

or:
<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">
[permalinks]
post = "/:year/:month/:filename/"
</code>

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

message=${1:-updated}
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}
popd</code>
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
</code>
gitlab  gitlab-ee  elasticsearch  searchandindex  webmaster  sysadmin  solution 
december 2019
Elasticsearch settings in /etc/gitlab/gitlab.rb not used/mentioned/synced (#1581) · Issues · GitLab.org / 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 · GitLab.org / 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:
<code>baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum</code>

Not positive how fussy GitLab is about the *exact* version (it says 5.6 - 6.x here - https://docs.gitlab.com/12.5/ee/integration/elasticsearch.html#version-requirements), but unsurprisingly you can get Elasticsearch 6.x OSS packages with this 'baseurl' instead:
<code>baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum</code>
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
p80.pool.sks-keyservers.net

This is a pool containing only servers available on port 80 (needs to be used as hkp://p80.pool.sks-keyservers.net:80)
hkps.pool.sks-keyservers.net

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 sks-keyservers.net CA, of which the certificate can be found at https://sks-keyservers.net/sks-keyservers.netCA.pem [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://hkps.pool.sks-keyservers.net
keyserver-options ca-cert-file=/path/to/CA/sks-keyservers.netCA.pem
</code>

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
</code>

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 https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations 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: https://unix.stackexchange.com/a/493477/278323)
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 multi-user.target --force
sudo systemctl set-default multi-user.target</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
</code>
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)
find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} g++ 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
Prevent .DS_Store file creation on network volumes - Mac OS X Hints
<code class="language-bash">find /Volumes/PSP/ | grep -ir '\(\._\..*\|\.AppleDouble\|\.AppleDesktop\|ws_ftp\.log\|Thumbs\.db\|pspbrwse\.jbf\)$' \
| sed 's/^\(.*\)$/rm -f "\1"/' | /bin/sh</code>
finder  mac  macos  annoyance  network  filesytem  sysadmin 
december 2019
How to Prevent .DS_Store File Creation
<code class="language-bash">defaults write com.apple.desktopservices DSDontWriteNetworkStores true</code>

See also: https://hints.macworld.com/article.php?story=2005070300463515
mac  macos  finder  annoyance  defaults  movein 
december 2019
Weekly Nightly Discussion for 2019-11-23 - 2019-11-29 Post about new features or bugs. : firefox
Set these both to **false** to stop the "megabar" effect from happening.
<code class="language-ini">browser.urlbar.update1 = true
browser.urlbar.update1.expandTextOnFocus = true</code>
firefox  urlbar  awesomebar  annoyance  configsetting  solution 
december 2019
#29763 (*_select framework does not apply to Perl: fix provided) – MacPorts
Status as of 06 December 2019:
You're not missing anything. It doesn't work yet. That's why this ticket is still open.
macports  perl  portselect  annoyance  needshelp 
december 2019
MacPorts - Developer - Re: Macports 2.0.3/Lion 10.7.2 Perl
As "man port" says, "Available select groups are installed as subdirectories of ${prefix}/etc/select/." So you can check that directory to see what things can be selected.
macports  interesting  alternatives  portselect 
december 2019
#53221 (perl_select not updated for Darwin 16) – MacPorts
My recollection is that perl_select has never been fully implemented and should not be used.

See also https://trac.macports.org/ticket/29763
macports  perl  portselect  annoyance  needshelp 
december 2019
« earlier      later »
per page:    204080120160

Copy this bookmark:





to read