Not using versioning on your configuration files and editing them with Vim?
Use Vim’s backup option to automatically keep a copy of past versions. To put in your ~/.vimrc
:
"Turn on backup option
set backup
[Unit] | |
Description=Clash service | |
After=network.target | |
[Service] | |
[Service] | |
Type=simple | |
StandardError=journal | |
User=clash |
#!/usr/bin/env python2.7 | |
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates. | |
# All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"). | |
# You may not use this file except in compliance with the License. | |
# A copy of the License is located at | |
# | |
# http://aws.amazon.com/apache2.0/ |
# You Should be able to Copy and Paste this into a powershell terminal and it should just work. | |
# To end the loop you have to kill the powershell terminal. ctrl-c wont work :/ | |
# Http Server | |
$http = [System.Net.HttpListener]::new() | |
# Hostname and port to listen on | |
$http.Prefixes.Add("http://localhost:8080/") |
Postgres provides us several options to do backup just like we want. I’ve tried several strategies in the past, and here is the one I stick to now, for both its simplicity and efficiency.
Backup your database with:
# This is using Postgres custom format
pg_dump -Fc dbname > filename
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
FROM python:3 | |
EXPOSE 8000 | |
CMD ["python", "-m", "http.server"] |
Contributed by Fabien Loudet, Linux SysAdmin at Rosetta Stone
Tired of always having to enter your SSH key passphrase when logging in to remote machines?
Here comes ssh-agent
. Enter the passphrase once and it will keep it in memory for you
Using ssh-agent in your shell session:
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
cat jwtRS256.key | |
cat jwtRS256.key.pub |
If you want to check whether a node run_list
includes a specific role (upon
expansion), then you could use role? method on the Node
object:
node.role?('name')
Alternatively, you can see whether either would work for you:
node.roles.include?('name')
node.run_list?('role[name]')