Skip to content

Instantly share code, notes, and snippets.

View nigimaster's full-sized avatar
💭
Veni, vidi, vici

Nicolo Giacomello nigimaster

💭
Veni, vidi, vici
  • NiGi
  • Utrecht, The Netherlands
View GitHub Profile
@nigimaster
nigimaster / iptabler.sh
Created August 10, 2020 18:29 — forked from Ttech/iptabler.sh
IPTABLE script
#!/bin/bash
####################################
#### ####
#### 2012 Ttech ####
#### Bash Router Enabler ####
#### ####
####################################
# this should be the only part you need to modify
@nigimaster
nigimaster / iptables-config-script
Created August 10, 2020 09:12 — forked from LouWii/iptables-config-script
Bash script to configure iptables for a web server. Some rules can be removed depending on used services.
#!/bin/sh
# Empty all rules
sudo iptables -t filter -F
sudo iptables -t filter -X
# Bloc everything by default
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
@nigimaster
nigimaster / k8s-offline.md
Created May 5, 2020 13:18 — forked from antonputra/k8s-offline.md
Offline Kubernetes installation with kubeadm and CentOS 7 v1.10.5

On master and nodes

Set environment variables

export MASTER01=<user>@<server>:<path>/<to>/<remote>/<folder>

Install docker daemon | 17.03 version recommended with k8s v.1.10.5

@nigimaster
nigimaster / nginx.conf
Created January 30, 2020 12:54 — 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
@nigimaster
nigimaster / gitcheats.txt
Created September 23, 2019 06:42 — forked from mkhairi/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# push changes to an empty git repository for the first time
git push --set-upstream origin master
# Remove + and - from start of diff lines
git diff --color | sed "s/^\([^-+ ]*\)[-+ ]/\\1/" | less -r
# clear out git hooks
@nigimaster
nigimaster / collected-snippets
Last active August 17, 2020 10:53
Collected snippets
### Jenkins
# start Jenkins in Shutdown mode
# init.groovy
import jenkins.model.*;
Jenkins.instance.doQuietDown();
# How to Start, Stop or Restart your Jenkins Instance
http://<jenkins.server>/restart
http://<jenkins.server>/safeRestart
http://<jenkins.server>/exit
@nigimaster
nigimaster / multi_brach_dsl_with_custom_strategy_and_script_path.groovy Jenkins Job DSL for a Multi-Branch Pipeline that includes Branch Source Strategy & custom Jenkinsfile script path
// A new UUID must be generated for the first run and re-used for your Job DSL, the plugin updates jobs based on ID
UUID uuid = UUID.fromString("dd847135-8391-4f66-a54c-7f8781dc3119") // generate one @ https://www.uuidgenerator.net
multibranchPipelineJob("my_awesome_job") {
displayName "my awesome job"
description "multi-branch pipeline job thingy"
configure {
it / sources / 'data' / 'jenkins.branch.BranchSource' << {
source(class: 'jenkins.plugins.git.GitSCMSource') {
id(uuid)
@nigimaster
nigimaster / baseURL.groovy
Created June 21, 2019 14:19 — forked from fishi0x01/baseURL.groovy
This is a collection of groovy scripts I gathered and use for bootstrapping Jenkins. Most of this can also be achieved with the CasC Plugin https://github.com/jenkinsci/configuration-as-code-plugin
#!groovy
/*
* This script configures the Jenkins base URL.
*/
import jenkins.model.JenkinsLocationConfiguration
JenkinsLocationConfiguration location = Jenkins.instance.getExtensionList('jenkins.model.JenkinsLocationConfiguration')[0]
location.url = 'https://jenkins-as-code-poc.devtail.io/'