Skip to content

Instantly share code, notes, and snippets.

View michaelkeevildown's full-sized avatar

Michael Down michaelkeevildown

View GitHub Profile
@michaelkeevildown
michaelkeevildown / scroll.py
Created July 1, 2016 14:39
Elasticsearch Python Scroll Script
########################################
# Tested on Elasticsearch Version: 2.x #
########################################
from elasticsearch import Elasticsearch
import certifi
index_name = 'index name here'
index_type = 'index type here'
@michaelkeevildown
michaelkeevildown / ubuntu-accounts.txt
Created July 6, 2016 08:48
Ubuntu Disable and Enable users
### Disable User
`sudo usermod -L -e 1 [username]`
### Enable user
`sudo usermod -U -e "" [username]`
@michaelkeevildown
michaelkeevildown / create-aws-user.txt
Created July 6, 2016 08:49
Create New AWS Ubuntu User
## Taken from: http://www.brianlinkletter.com/how-to-set-up-a-new-userid-on-your-amazon-aws-server-instance/
Create a new userid, with password
We will create a new account with userid brian. If you run into any trouble, consult the Amazon AWS documentation. To create the new account, first login to your AWS server with a command similar to:
Laptop:$ ssh -i ~/Documents/Ubuntu-2-keypair.pem ubuntu@54.175.34.164
Then create the new user brian (or your choice) using the command:
ubuntu@AWS:$ sudo adduser brian
@michaelkeevildown
michaelkeevildown / port-scan.txt
Created August 5, 2016 14:14
Digital Ocean - Port Scan Dump
11:07:05.883154 IP 212.71.238.108.45939 > 139.59.178.38.2481: UDP, length 229
11:07:05.885476 IP 212.71.238.108.45939 > 139.59.178.38.2481: UDP, length 1
11:07:05.887707 IP 212.71.238.108.45939 > 139.59.178.38.2481: UDP, length 48
11:07:05.890172 IP 212.71.238.108.35351 > 139.59.178.38.2469: UDP, length 46
11:07:05.890191 IP 212.71.238.108.52112 > 139.59.178.38.2465: UDP, length 113
11:07:05.890198 IP 212.71.238.108.42957 > 139.59.178.38.2466: UDP, length 113
11:07:05.890206 IP 212.71.238.108.45027 > 139.59.178.38.2471: UDP, length 46
11:07:05.890225 IP 212.71.238.108.59236 > 139.59.178.38.2484: UDP, length 50
11:07:05.898955 IP 212.71.238.108.54349 > 139.59.178.38.2458: UDP, length 61
11:07:05.898975 IP 212.71.238.108.40055 > 139.59.178.38.2462: UDP, length 61
@michaelkeevildown
michaelkeevildown / replace.pl
Created September 7, 2016 12:32
Perl Replace One Liner
perl -pi -w -e 's/FROM/TO/g;' *.xml
@michaelkeevildown
michaelkeevildown / credit-card-regex.md
Last active April 17, 2024 20:36
Credit Card Regex Patterns

Credit Card Regex

  • Amex Card: ^3[47][0-9]{13}$
  • BCGlobal: ^(6541|6556)[0-9]{12}$
  • Carte Blanche Card: ^389[0-9]{11}$
  • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
  • Discover Card: ^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
  • Insta Payment Card: ^63[7-9][0-9]{13}$
  • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
  • KoreanLocalCard: ^9[0-9]{15}$
@michaelkeevildown
michaelkeevildown / es-reindex-with-script.md
Last active March 12, 2020 21:22
Reindex Elasticsearch Data With Script

How to reindex data and using inline (painless) script

PUT /data/logs/1
{
  "title": "This is a document",
  "one": 1,
  "two": 2
}
@michaelkeevildown
michaelkeevildown / amazon-cloud-drive-upload.md
Created October 3, 2016 12:48
Amazon Cloud Drive Upload

Upload all folders to Amazon Cloud Drive

for i in */; do echo $i; acd_cli upload "$i" /amazon/cloud/drive/path/; done

@michaelkeevildown
michaelkeevildown / test-logstash-config
Created October 19, 2016 12:04
Simple Logstash Test Config
input {
stdin {
}
}
filter {
}
output {
stdout { codec => rubydebug }
@michaelkeevildown
michaelkeevildown / es-v5.x-poc.md
Created October 28, 2016 12:34
Elasticsearch 5.0 POC Template

Elasticsearch v5.x POC Template

PUT _template/poc
{
  "order": 0,
  "template": "poc-*",
  "settings": {
    "index": {
 "number_of_shards": "1",