Skip to content

Instantly share code, notes, and snippets.

@sati2013
sati2013 / README-tomcat-as-systemd-service.md
Created August 16, 2021 16:39 — forked from drmalex07/README-tomcat-as-systemd-service.md
An example configuration for Tomcat as systemd service. #tomcat #systemd #systemd.service

README

Let Tomcat is download and installed under /opt/tomcat. Also, let tomcat be a non-provileged user under which the server will be running.

We assume that we keep server's binaries under /opt/tomcat and we will create a server instance named foo under /var/tomcat/ (carrying its own conf, logs, webapps, work, lib directories). See also https://dzone.com/articles/running-multiple-tomcat.

Create a template service unit file at /etc/systemd/system/tomcat@.service:

@sati2013
sati2013 / noip2.service
Created July 9, 2019 16:40 — forked from NathanGiesbrecht/noip2.service
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl enable noip2`
# 5) Execute `sudo systemctl start noip2`
#

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

push_key() {
ssh-add -L | ssh ${1} "umask 077; [ -d .ssh ] || mkdir .ssh; cd .ssh; cat >> authorized_keys;ls -la authorized_keys"
}
netstat -an | awk '{print $7}' | sort | uniq -c
@sati2013
sati2013 / gist:4680442
Last active December 11, 2015 23:58 — forked from bortzmeyer/gist:1284249
#!/usr/bin/python
# All SSH libraries for Python are junk (2011-10-13).
# Too low-level (libssh2), too buggy (paramiko), too complicated
# (both), too poor in features (no use of the agent, for instance)
# Here is the right solution today:
import subprocess
import sys
@sati2013
sati2013 / gist:4545085
Created January 16, 2013 06:25
Perl options test
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
my %opts;
GetOptions(\%opts,
@sati2013
sati2013 / gist:4545078
Created January 16, 2013 06:22
Perl Gists
#!/bin/bash
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir=>1},@INC'
for i in user1 user2 user3...
do
echo -n 'useradd -m -s /bin/bash -u '$(grep $i /etc/passwd | cut -d':' -f3) && echo -en ' \
-p' \'$(grep $i /etc/shadow | cut -d ':' -f2)\' $i '\n'
done
Output :