cpulimit is a simple program which attempts to limit the cpu usage of a process (expressed in percentage, not in cpu time). This is useful to control batch jobs, when...
...eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself...
Understanding your type of cronjob Some cronjobs must only run on a single server. E.g. when you run nightly batch operations on the database, it should probably run on a...
...single server. Running it on multiple servers would likely result in deadlocks or corrupt data. Some cronjobs must always run on all servers. E.g. starting a sidekiq process on reboot...
There are two ways a logout in SAML can happen: Service Provider (SP) initiated and Identity Provider (IDP) initiated logout. I'll explain how to implement both flows with devise...
...on logout and devise does not do that we get a Unsafe redirect to "https://some-idp.example.com/realms/dev/protocol/saml?SAMLRequest=fZJBb9QwEIX%2FSm45zcZx4j...", pass allow_other_host: true to redirect anyway. upon trying to logout.
Regular expressions extract structured data from text. This lesson teaches you to write, read and test them, and shows where they are the right tool and where they aren't...
...You can keep a complex pattern readable, e.g. with the /x flag, comments or nested sub-patterns. You can test a pattern interactively, and you know that line breaks and...
PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or Algolia, but it's good enough if you just need...
...to search and rank large volumes of text. This card will teach you how to index, search and rank your Rails models in a PostgreSQL full-text index. We will...
Here is how to use Chromedriver without libraries like selenium-webdriver. This can be useful for debugging. The following example visits a web page and reads the a headline's...
...things you can do with it, but performing more advanced tasks without a tool like selenium-webdriver can be quite difficult. However, for simple debugging or remote-controlling, curl might...
...Object into Integer (TypeError) Integer(2) # 2 Integer("11", 2) # 3 This is very similar but not identical to to_i: "2".to_i # 2 "foo".to_i # 0
...an instance of Object (NoMethodError) 2.to_i # 2 "11".to_i(2) # 3 Integer() supports a exception: false variant, which is very handy to cast user input without any exception...
The nokogiri gem provides different packages for several platforms. Each platform-specific variant ships pre-built binaries of libxml2, e.g. x86_64-linux includes binaries for 64bit Linux on Intel/AMD...
...This significantly speeds up installation of the gem, as Nokogiri no longer needs to compile libxml2. However, this also means that for each security issue with libxml2, Nokogiri maintainers have...
...ActiveRecord model. Form models hold the validations and logic of a single screen, like a sign-up form, without overloading your core models. Important Work on this lesson in advisor...
Learning goals You can explain why logic that belongs to one screen — its validations, callbacks, virtual attributes — should not live on the core model, and what goes wrong when...
In SQL, NULL represents an "unknown" value. Because of this, it does not behave like a standard piece of data when used in comparison operators. If you don't account...
If you attempt to update or filter these users using a standard toggle, you might run the following queries: SELECT * FROM users WHERE name = 'Alice';
Flash movies (.swf files) can talk with Javascript code embedded in the same HTML page. There are two ways to do this: The preferred way is to use the ExternalInterface...
...ActionScript by calling SetVariable(name, value) on the Flash movie's DOM element. This is super-legacy, but still encountered in the field. Note that communication between a Flash movie...
This note is a reminder that there is something called AppArmor that could cause weird errors ("File not found", "Can't open file or directory", ...) after configuration changes, e.g. when...
If you are using our opscomplete.com hosting we can set all environment variables mentioned below for your deployment on request. If you're lucky DO_NOT_TRACK=1 opts...
...are collecting data only after you opt into that. ng analytics --global disable Storybook https://storybook.js.org/docs/configure/telemetry npm run storybook -- --disable-telemetry npm run storybook -- --disable-crash-reports export STORYBOOK...
...throw in some locking mechanism, but then are usually done with it. Unfortunately, transactions semantics in databases are actually very complicated, and chances are, your making some incorrect assumptions.
...engine actually has four different modes for transactions: READ UNCOMMITTED READ COMMITTED REPEATABLE READ SERIALIZABLE READ UNCOMMITED gives you the least isolation between transactions (i.e. one transaction can see most...
...messages should include the ID of the issue your code belongs to. Our preferred syntax prefixes the issue title with its ID in brackets, e.g. [FOO-123] Avatars for users...
...d+):?\s*/, '[$1] ')) .filter(Boolean); if (!titles.length) { return alert('Error: No linear issues selected'); } output = titles.join('; '); } if (prompt('Commit message: Copy to clipboard?', output)) { navigator.clipboard.writeText(output) } })(); When viewing an issue...
...for DOM elements, there are some footguns you should know about. Some lists are synchronized with the DOM Some DOM APIs return live lists that automagically update their contents as...
...reflects the change automatically: document.querySelector('#two').remove() console.log(liveList) // [#one] console.log(nonLiveList) // [#one, #two] Snapshotting a live list Lists that silently change their elements can be very surprising to work...
When your application is open for public sign up and sends out transactional e-mails to a large number of users, e-mail deliverability becomes an issue. E-mail providers...
...work hard to eliminate spam and have put in place relatively tight checks what kinds of emails they will accept, and from whom. To that end we use tools like...
...forget that bad resolution: git rerere forget your_file.rb Afterwards, the badly resolved file will still be in your working directory. To get it back with confict markers, say:
...of a Linux process, like so: $ faketime 'last Friday 4 pm' date Fr 12. Sep 16:00:00 CEST 2025 However, we cannot just modify the time of the docker...
...need to affect the command being run inside the image. So we need to smuggle faketime into the container somehow, and activate it for the process being run.
...is defined incorrectly. Raise the attributes hash given to your :reject_if lambda to see if it looks like you expect. If you are nesting forms into nested forms, each...
...a new parent record together with a new child record and will need to save the parent before you can save the child. You can opt to only show the...
Terser is a really good minifier ("compressor") for JavaScript code. I'm often surprised by the thoughtfulness of its compressed output. Let's take this function: function fn() {
...this to the following code: console.log(a||b?"foo":c()) Note how: The if statement has been replaced by a tertiary expression. This is often less readable, but it doesn...
Git is our version control system. This lesson covers the everyday moves — committing, branching, merging, working with a remote — and the habits that make your history pleasant to review.
...in teacher mode. Learning goals You can explain where a change lives at each stage — working copy, staging area, local repository, remote — and how it moves between them.
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method on Enumerable that combines the three: module Enumerable
group_by(&block) .transform_values(&:count) .sort_by(&:last) .to_h end end Just paste that snippet into a Rails console and use #count_by now! Usage examples...
Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine...