/[!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/
Punctuations, include Unicode ones (\u2000-\u206F: general punctuations, \u2E00-\u2E7F: supplemental punctuations)
/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"syscall" | |
) |
#! perl -slw | |
use strict; | |
( my $input = do{ local $/; <DATA> } ) =~ tr[\n][]d; | |
my $tab = 0; | |
$input =~ s[([()])]{ | |
$tab-- if $1 eq ')'; | |
my $modified = "\n" . ( " " x $tab ) . $1; | |
$tab++ if $1 eq '('; |
Services declared as oneshot
are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo
service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh
:
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/mail" | |
"net/smtp" | |
"crypto/tls" | |
) |
#!/bin/bash | |
# Copyright 2013 Percona LLC and/or its affiliates | |
# @see https://www.percona.com/blog/2013/12/24/renaming-database-schema-mysql/ | |
set -e | |
if [ -z "$3" ]; then | |
echo "rename_db <server> <database> <new_database>" | |
exit 1 | |
fi | |
db_exists=`mysql -h $1 -e "show databases like '$3'" -sss` | |
if [ -n "$db_exists" ]; then |