Skip to content

Instantly share code, notes, and snippets.

@Forst
Forst / build.sh
Last active October 25, 2022 23:43
Ubuntu ISO with preseed.cfg generation script
#!/bin/bash
## FORSTWOOF UBUNTU PRESEED :: BUILD SCRIPT
# Quit on first error
set -e
# Temporary directory for the build
TMP="/var/tmp/ubuntu-build"
@sonots
sonots / label1.md
Last active April 1, 2019 20:31
fluentd label and filter (1)
# fluent.conf
<source>
  type dummydata_producer
  tag dummy.data
  rate 500
  dummydata0 {\"type\":\"sample\",\"code\":50,\"format\":\"json string allowed\"}
  dummydata1 {\"message\":\"other format needed?\"}
  dummydata2 {\"comment\":\"N of dummydataN is number and not limited\"}
 @label @raw
@peterjaap
peterjaap / server.rewrites
Last active February 7, 2019 06:15
Conditionally switching HTTPS for different domains in nginx
# Unfortunately, we are not able to set the server {} due to hosting limitations.
# So we don't care that if is evil. We love if. Hooray for if!
# We want to redirect HTTP traffic to HTTPS, but only for two of our domains (the other domains still only use HTTP)
# set a var to 0 so when after a redirect, the existing connection is still used,
# the flag is set back to 0 instead of remembering its previosly set value
set $http 0;
# give the var a random value (in this case 1) when the if statement is true
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active December 19, 2024 09:32
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 12, 2025 11:12
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@pgilad
pgilad / Instructions.md
Last active March 31, 2024 22:30
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@mariussturm
mariussturm / gist:0b885812500d91df8c3a
Last active January 9, 2023 12:57
Graylog2 create inputs/streams/alerts
#!/bin/bash
sleep 3
IP_ADDRESS=$(hostname -I | cut -f1 -d' ')
GRAYLOG2_URL="http://admin:admin@${IP_ADDRESS}:12900"
GRAYLOG2_INPUT_GELF_TCP='
{
"global": "true",
@jmervine
jmervine / cert_convert.sh
Created November 17, 2014 21:57
openssl: convert cert from p7b to crt (or cer)
openssl pkcs7 -print_certs -in old.p7b -out new.crt
# openssl pkcs7 -print_certs -in old.p7b -out new.cer
@glaucocustodio
glaucocustodio / Default.sublime-theme
Created January 5, 2015 16:30
Increase font size and row padding from Sublime Text 3's sidebar
// for the ST3 users who don't have the Default.sublime-theme file (which is actually the default configuration),
// the simplest procedure is:
// 1- Navigate to Sublime Text -> Preferences -> Browse Packages
// 2- Open the User directory
// 3- Create a file named Default.sublime-theme with the following content (modify font.size as required):
[
{
"class": "sidebar_label",
"color": [0, 0, 0],
"font.size": 16