Skip to content

Instantly share code, notes, and snippets.

@wshayes
wshayes / Dockerfile-es
Last active April 21, 2022 02:59
Elasticsearch and Kibana using docker-compose (v3)
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1
RUN \
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack
@ckarnell
ckarnell / .vimrc
Created June 27, 2017 13:58
Replacing syntastic with neomake for linting
" Step 1: Install this: https://github.com/neomake/neomake
" Step 2: Put these in your .vimrc:
" Neomake settings
autocmd! BufWritePost,BufEnter * Neomake
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_scss_enabled_makers = ['scss_lint']
let g:neomake_python_enabled_makers = ['pylint', 'python']
" Step 3: Delete syntastic stuff after you've verified neovim works
@negz
negz / kubedump.sh
Last active July 11, 2024 10:57
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@akirattii
akirattii / docker-mysql-slow-query-log.md
Last active July 14, 2023 22:12
memo: MySQL docker container settings for slow query log

Check running mysql container:

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
26137efa979f        mysql               "docker-entrypoint..."   8 months ago        Up 10 minutes       0.0.0.0:3306->3306/tcp   container-mysql

Check docker container mysql version:

$ sudo docker exec container-mysql mysqld --version`
mysqld  Ver 5.7.15 for Linux on x86_64 (MySQL Community Server (GPL))
@deboorn
deboorn / decode-jwt-web-token.php
Created May 31, 2017 21:19
Decode JSON Web Token with Public Key
<?php
// Example of decoding JWT Web Token with public key
// Package: https://github.com/firebase/php-jwt
require_once 'vendor/autoload.php';
use \Firebase\JWT\JWT;
$key = "-----BEGIN PUBLIC KEY----- YOUR PUBLIC KEY HERE -----END PUBLIC KEY-----";
@Brainiarc7
Brainiarc7 / xclip-copy-to-clipboard.md
Created April 26, 2017 17:53
Using xclip to copy terminal content to the clip board on Linux

Using xclip to copy terminal content to the clip board:

Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.

For the mouse clipboard, pipe straight to xclip:

echo 123 | xclip

For the system clip board, pipe to xclip and select clip directly:

@tuxfight3r
tuxfight3r / ldap_notes.txt
Last active September 20, 2024 16:04
LDAP Search / with TLS
### LDAP SEARCH ###
#search by user
ldapsearch -xv -h ad1.domain.local -p 389 -b "dc=domain,dc=local" -D "[email protected]" \
-W "(&(objectClass=user)(sAMAccountName=user123))"
#search by user but dont wrap the output
ldapsearch -x -H ldap://ad1.domain.local -b "dc=domain,dc=local" -D "[email protected]" \
-W "(&(objectClass=user)(sAMAccountName=user123))" -o ldif-wrap=no
@jdeathe
jdeathe / apache_maintenance_page.md
Last active March 5, 2024 09:47
Simple HTML Maintenance Page for Apache using rewrite_module

Apache - Maintenance Page

  • Activate/Deactivate with a file.
  • Bypass with a custom request header.

With the following Apache Rewrite rule, temporarily redirect all traffic to a maintenance page when a file named maintenance exists at the same level as the DocumentRoot directory. i.e. if your DocumentRoot is /var/www/public_html/ then creating the file /var/www/maintenance would trigger Maintenance mode.

Use something like the ModHeader Chrome browser extension to bypass the maintenance page by setting a X-Maintenance request header with a value of tF0BOCn4z8HgG2Kw (replace this with your own unique passcode string).

Instructions

@sahilsk
sahilsk / kafka-rebalancing.md
Last active March 11, 2023 12:41
Kafka-rebalancing

Lets say i want to rebalance my-sample-topic topic on my kafka cluster

Create topcis.json

{
  "version": 1,
  "topics": [
 { "topic": "my-sample-topic" 
@kekru
kekru / add CA cert on CentOS Debian Ubuntu.md
Last active December 30, 2024 09:31
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org