Skip to content

Instantly share code, notes, and snippets.

View tomcbe's full-sized avatar

Thomas Bernhart tomcbe

View GitHub Profile
@tomcbe
tomcbe / puma.service
Created June 28, 2019 17:06 — forked from casperbrike/puma.service
Puma service for systemd
# username
# appname
# gemset
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=forking
@tomcbe
tomcbe / openssl_commands.md
Last active October 1, 2019 16:23 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl

Update 7/28/2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

Steps:

  1. Open VirtualBox
  2. Right-click your VM, then click Settings
  3. Go to Shared Folders section
@tomcbe
tomcbe / restore-config-files-with-apt.md
Last active June 11, 2022 14:59
Restoring config files with apt

Find out what package installed the config file:

$ dpkg -S unity-greeter.conf
unity-greeter: /etc/lightdm/unity-greeter.conf

As you can see, the name of the package is unity-greeter.

If you deleted a directory, like /etc/pam.d, you can list every package that added to it by using the directory path:

@tomcbe
tomcbe / slash.sh
Created June 14, 2020 12:27 — forked from luciomartinez/slash.sh
Add or Remove trailing slash in bash
### Add trailing slash if needed
STR="/i/am/a/path"
length=${#STR}
last_char=${STR:length-1:1}
[[ $last_char != "/" ]] && STR="$STR/"; :
echo "$STR" # => /i/am/a/path/
@tomcbe
tomcbe / rails.md
Created October 19, 2020 10:28 — forked from zulhfreelancer/rails.md
Delete all tables data and recreate tables in Rails

You can have finer control with:

rake db:drop:all

And then create the database without running the migrations:

rake db:create:all

Then run all your migrations: