Skip to content

Instantly share code, notes, and snippets.

View oscp_stapling.sh
openssl ocsp -noverify -no_nonce -issuer issuerName.pem -cert net.pem -url http://ocsp.gandi.net -respout net.pem.ocsp
@toddlers
toddlers / es_index_rotate.sh
Last active Jan 10, 2018
rotate elasticsearch indices for a given time window
View es_index_rotate.sh
#!/bin/bash
#
# "Script to rotate Elasticsearch logs given the index pattern and number of days."
# Index names must contain date string in format YYYY.MM.DD
#
# We can use curator(https://github.com/elastic/curator) too for this job
# curator --host localhost delete indices --older-than 30 --time-unit days --timestring '%Y.%m.%d'
abort() {
View sshencryption.md

ENCRYPT A FILE USING A PUBLIC SSH KEY

Generate the symmetric key (32 bytes gives us the 256 bit key):

$ openssl rand 32 -out secret.key

You should only use this key this one time, by the way. If you send something to the recipient at another time, don’t reuse it.

@toddlers
toddlers / dockerhubk8s.md
Last active Jan 17, 2019
docker hub with kubernetes in GKE
View dockerhubk8s.md
  • Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
export SECRETNAME=acmeorg
@toddlers
toddlers / gist:de127f24ba917028dc2aaaf5104f8622
Created Dec 12, 2017 — forked from bergantine/gist:4487752
Concatenate files in a directory into a single file. #ruby #donnieclapp
View gist:de127f24ba917028dc2aaaf5104f8622
# Iterates over files and subdirectories in directorie[s] given as arguments
# and adds raw text of those files to merged.txt in the working directory
# where the script is called
# Call like this:
# ruby merge.rb {absolute path portion to delete} {directory to scan} [{directory to scan}]
# For example:
# ruby merge.rb /Users/donnieclapp/Projects/ ~/Projects/htl-website/myproject/static_media/stylesheets
# create or open the merged.txt file for writing (in working directory)
@toddlers
toddlers / listlinkswebpage.md
Last active Nov 22, 2017
list links in web pages
View listlinkswebpage.md
  • For listing the links inside a web page
    • Install lynx using brew install lynx on mac
    • Run following command for listing the links
      lynx -listonly -dump soompi.com
      
    • Results
      git:master=⚡ lynx -listonly -dump soompi.com
      
View debug_tag_spaces.md

makefile has a very stupid relation with tabs , all actions of every rule are identified by tabs. and No 4 spaces dont make a tab , only a tab makes a tab...

to check i use the command

cat -e -t -v  makefile_name

it shows the presence of tabs with ^I and line endings with $ both are vital to ensure that dependencies end properly and tabs mark the action for the rules so that they are easily identifiable to the make utility.

@toddlers
toddlers / ipv6off.md
Last active Nov 9, 2017
Disable IPV6
View ipv6off.md

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

cat /proc/sys/net/ipv6/conf/all/disable_ipv6
@toddlers
toddlers / haproxy.cfg
Created Oct 28, 2017
Haproxy config file for SSL and basic authentication
View haproxy.cfg
userlist logsusers
user username insecure-password passowrd
frontend https_external
acl search_logsusers http_auth(logsusers)
bind 0.0.0.0:443 ssl crt net.pem npn http/1.1 no-sslv3 no-tls-tickets
http-request auth unless search_logsusers
reqadd X-Forwarded-Proto:\ https
@toddlers
toddlers / ansible_gitclone_issue_fix
Created Oct 28, 2017
Solution for `git clone` using Ansible for repos with private submodules with github deploy keys
View ansible_gitclone_issue_fix
# Problem:
#
# If you use git submodules linking two private github repos, you'll need to create a separate deploy key for each.
# Multiple keys are not supported by Ansible, nor does ansible (when running git module) resort to your `.ssh/config` file.
# This means your ansible playbook will hang in this case.
#
# You can however use the ansible git module to checkout your repo in multiple steps, like this:
#
- hosts: webserver
vars:
You can’t perform that action at this time.