Skip to content

Instantly share code, notes, and snippets.

View tomcbe's full-sized avatar

Thomas Bernhart tomcbe

View GitHub Profile
@tomcbe
tomcbe / task.yml
Created April 13, 2018 17:09 — forked from maxim/task.yml
Adding github to known_hosts with ansible
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@tomcbe
tomcbe / nginx.conf
Created May 2, 2018 16:34 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@tomcbe
tomcbe / AdminRestApi.ps1
Created August 23, 2018 15:22 — forked from eonarheim/AdminRestApi.ps1
PowerShell DSC Configuration for the new Microsoft IIS.Administration Rest API
configuration AdminRestAp {
Import-DscResource -ModuleName xPSDesiredStateConfiguration
Import-DscResource -ModuleName xNetworking
Node "webserver" {
<#
Install windows features
#>
WindowsFeature InstallIIS {
@tomcbe
tomcbe / Script_Template.ps1
Created September 27, 2018 14:49 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@tomcbe
tomcbe / Logging_Functions.ps1
Created September 27, 2018 14:49 — forked from 9to5IT/Logging_Functions.ps1
PowerShell: Logging Functions
Function Log-Start{
<#
.SYNOPSIS
Creates log file
.DESCRIPTION
Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one.
Once created, writes initial logging data
.PARAMETER LogPath
@tomcbe
tomcbe / start-stop-daemon.sh
Created October 18, 2018 08:35 — forked from wancaibida/start-stop-daemon.sh
start-stop-daemon script for java application
#!/bin/sh
DESC="Java Service"
NAME=java-service
PIDFILE=/tmp/$NAME.pid
PATH_TO_JAR=~/java-service.jar
PATH_TO_JAVA=/usr/local/jdk1.8.0_131/bin/java
SERVICE_CONFIG='-Dserver.port=8080 -DLOG_PATH=/var/log'
COMMAND="$PATH_TO_JAVA -- $SERVICE_CONFIG -jar $PATH_TO_JAR"
@tomcbe
tomcbe / git-stop-tracking-remote-branch.md
Created January 15, 2019 15:39 — forked from magnusbae/git-stop-tracking-remote-branch.md
How to make Git stop track a remote branch without deleting the remote branch.

You don't have to delete your local branch.

Simply delete your remote tracking branch:

git branch -d -r origin/<remote branch name> (This will not delete the branch on the remote repo!)

See "Having a hard time understanding git-fetch"

there's no such concept of local tracking branches, only remote tracking branches.

@tomcbe
tomcbe / clean-up-boot-partition-ubuntu.md
Created May 29, 2019 15:24 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@tomcbe
tomcbe / gist:93d9a6eefee27dec3d30bd937602c1df
Created June 10, 2019 21:59 — forked from tuxfight3r/gist:51d42005694c76286e80
mirror maven repository via wget
wget -P/local/target/directory -r -nH -np --reject html http://mirrors.dotsrc.org/maven2/
wget will put a maven2 repository folder under /local/target/directory on your machine, along with all the repositories artifacts.
@tomcbe
tomcbe / puma.service
Created June 28, 2019 17:05 — forked from r00takaspin/puma.service
Run puma web server with RVM from systemd
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple