Creează un cont pentru a te abona la acest blog și a-i urmări articolele pe pagina Lectură.
-
With IRB Link to heading Add irb to your Gemfile (yes you need to do this)!
-
To set up Gemfile functionality do this: #!
-
Add these gems to your Gemfile: # frozen_string_literal: true group :development, :test do gem 'minitest' gem 'rake' gem 'simplecov' end Run bundle install to install them.
-
number = 12345678 number.to_s.gsub(/\B(?
-
The proper one Link to heading If you don’t have any keys, generate a default one: ssh-keygen -t ed25519 -a 100 -q -N "" -f ~/.ssh/id_ed25519 And if you want it generated in the current directory do: ssh-keygen -t ed25519 -a 100 -q -N "" -f "$PWD"/rename…
-
# ------------------------------------------------------------------------------ # Base FROM alpine:3.12.1 # ------------------------------------------------------------------------------ # Packages RUN set -exo pipefail && \
-
Basic command: tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 32 Print it to STDOUT: echo $(tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 32) Save it in an environment variable: export SECRET_PASSWORD=$(tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 32)
-
Start the console with Ctrl + Shift + K Run: document.designMode = 'on' Close the console with Ctrl + Shift + I And now you can edit any text directiny into the page.
-
File Link to heading Create a temporary file in your current directory: require 'tempfile' Tempfile.create('', Dir.pwd) do |file| puts File.path(file) File.write(file, 'I am temporary!')
-
Say you have a complex object like: state = {a: 1, b: '2', c: [3, 4, 5]} And you want to display it nicely to standard output.
-
Want to show somebody your hardware/OS specs?
-
Use this template as a sterter for your Makefile, making sure you intent using tabs as that’s a hard requirement of the make tool. #------------------------------------------------------------------------------- # Settings #-------------------------------…
-
Use this as a template for ruby apps: #------------------------------------------------------------------------------- # Base FROM ruby:2.7.2-alpine SHELL ["/bin/ash", "-c"] #-----------------------------------------------------------------------------…
-
This is a docker entrypoint script that loads environment variables from a mounted file and executes the given command; most of the time it’s all you need. #!
-
Python has: python3 -m http.server But I like Ruby, so I do this instead: # Basic: ruby -run -e httpd # With arguments: ruby -run -e httpd -- -b 0.0.0.0 -p 9090 Note: there is no such thing as a -run flag for ruby, you’re doing -r for require and you’re
-
Ruby is amazing!
-
Source: https://gitlab.com/sdwolfz/docker-here Install Link to heading git clone https://gitlab.com/sdwolfz/docker-here.git cd docker-here sudo make install Usage Link to heading Instead of doing this: docker run --rm -it -u "$(id -u)":"$(id -g)" -v "$PW…
-
Required Link to heading You need a name and email otherwise commits won’t work: git config --global user.name 'Your Name' git config --global user.email 'your.email@faang.com' Global .gitignore Link to heading Don’t put junk like these in your poject’s…
-
Website: https://snapcraft.io Snaps are amazing, I don’t understand why people hate them, tell me another way you can reliably install and update apps like these with a single command: acrordrdc (Adobe Acrobat Reader) androidsdk (Android SDK) drawio (Diag…
-
Install Link to heading From package: # Manjaro / Arch sudo pacman -S yamllint # Alpine apk add --update yamllint From Docker (no official image so use mine): docker run --rm -it -v "$PWD":/work -w /work sdwolfz/yamllint:latest sh Configure Link to hea…
-
Install Link to heading From package: # Manjaro / Arch sudo pacman -S shellcheck # Alpine apk add --update shellcheck From Docker: docker run --rm -it -v "$PWD":/work -w /work koalaman/shellcheck-alpine:latest sh Configure Link to heading Add a .shellc…
-
Install Link to heading It’s not available in any package manager, so use the Docker image: docker run --rm -it -v "$PWD":/work -w /work hadolint/hadolint:latest-alpine sh Configure Link to heading Add a .hadolint.yaml file containing your rules: --- ig…
-
Define an anchor using the & character and reference it everywhere using the <<: * alias: version: '2.4' x-default-logging: &logging logging: options: max-size: '12m' max-file: '5' driver: json-file services: web: image: alpi…
-
Install Link to heading # Manjaro / Arch sudo pacman -S gettext # Alpine apk add --update gettext Usage Link to heading Create a template input file .
-
This is editorconfig: https://editorconfig.org This is the checker: https://github.com/editorconfig-checker/editorconfig-checker Install Link to heading The CLI tool: # Manjaro / Arch sudo pacman -S git editorconfig-checker # Alpine apk add --update git…
-
The bad way: count = 3.to_s puts 'I ate ' + count + ' burgers today!'
-
Install java: sudo pacman -S jdk8-openjdk jre8-openjdk jre8-openjdk-headless Install Android SDK: sudo pacman -S snapd sudo snap install androidsdk Configure your SDK location in your ~/.bash_profile or ~/.bashrc: export ANDROID_SDK_ROOT=~/snap/androids…
-
Good Link to heading export HISTCONTROL=ignoreboth:erasedups export HISTSIZE=5000000 export HISTFILESIZE=5000000 export HISTFILE=/home/$USER/.bash_history_persistent shopt -s histappend export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" It’s crucial th…
-
Add the pry-byebug gem, together with irb, to your Gemfile: group :development, :test do gem 'irb' gem 'pry-byebug' end Add a .pryrc file to your project containing: # frozen_string_literal: true if defined?
-
Prerequisites Link to heading Install Emacs Install Link to heading Clone and link the repository: git clone https://github.com/cask/cask.git rm -rf ~/.cask ln -s "$PWD"/cask ~/.cask Add this to your .bash_profile: export PATH=~/.cask/bin:$PATH Install…
-
Create the ~/.gemrc file with the following content: gem: --no-rdoc --no-ri --user-install Add these lines to your .bash_profile: for entry in ~/.gem/ruby/*; do PATH=$entry/bin:$PATH; done export PATH export BUNDLE_PATH=~/.gem/bundle Now you can install
-
Create the ~/.npmrc file with the following content: prefix = "~/.local" Add the following line to your .bash_profile: export PATH=~/.local/bin:$PATH Now you can install a npm package without your root password: npm install -g eslint which eslint # /ho…
-
Setup Link to heading Add the restclient layer to your .spacemacs: dotspacemacs-configuration-layers '( restclient ) Secrets Link to heading Define the following function in your dotspacemacs/user-config: (defun restclient-envchain-get (namespace varia…
-
Install Link to heading sudo pacman -S fzf Setup Link to heading Add the following lines to your .bash_profile: [[ -f /usr/share/fzf/completion.bash ]] && .
-
Let’s say you have the following 5 numbers: values = [100, 200, 300, 400, 500] To predict the next 3 in this series you need linear regression: def linear_regression(pairs) n = pairs.size sum_x = pairs.map { |x, _| x }.sum.to_f sum_y = pairs.map {…
-
Install Link to heading git clone https://github.com/sorah/envchain.git cd envchain make sudo make install Usage Link to heading Store a new environment variable with the following command, adding the value after the prompt: envchain -s -n namespace MY_N…
-
Prerequisites Link to heading sudo pacman -S libgccjit Compile Link to heading git clone git://git.sv.gnu.org/emacs.git cd emacs .