Skip to content

Instantly share code, notes, and snippets.

View deerme's full-sized avatar

Pedro V deerme

View GitHub Profile
@deerme
deerme / ConfigureSplunkForwarder.sh
Created October 25, 2018 03:20 — forked from iarrup/ConfigureSplunkForwarder.sh
Configure Splunk Universal Forwarder on Ubuntu
## Download the splunk universal forwarder
# Would probably need to login to splunk first.
wget -O splunkforwarder-6.3.3-f44afce176d0-linux-2.6-amd64.deb 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version=6.3.3&product=universalforwarder&filename=splunkforwarder-6.3.3-f44afce176d0-linux-2.6-amd64.deb&wget=true'
## install
# It gets installed in /opt/splunkforwarder
sudo dpkg -i splunkforwarder-6.3.3-f44afce176d0-linux-2.6-amd64.deb
## add the entry to init.d
@deerme
deerme / count_vectorizer_pandas.py
Created April 28, 2019 21:44 — forked from kovid-rathee/count_vectorizer_pandas.py
How to vectorize sentences using a Pandas and sklearn's CountVectorizer
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer()
corpus = [ 'This is a sentence',
'Another sentence is here',
'Wait for another sentence',
'The sentence is coming',
'The sentence has come'
]
  1. First get to the existing directory
    $ cd my/folder/

  2. Now start a new git repository
    $ git init

  3. Identify if the current elements on the directory are needed or not and add them to the .gitignore file. When ready...
    $ vim .gitignore

  4. When ready create the first commit on the server

@deerme
deerme / Documentation.md
Created July 3, 2020 16:31 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@deerme
deerme / bot.rb
Created July 8, 2020 05:27 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@deerme
deerme / self-signed-certificate-with-custom-ca.md
Created August 6, 2020 17:16 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@deerme
deerme / cmd.sh
Created October 26, 2020 19:53 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@deerme
deerme / brainwallet.py
Created February 7, 2021 12:47 — forked from stequald/brainwallet.py
Bitcoin brain wallet in Python.
#!/usr/bin/env python
import hashlib, binascii
from hashlib import sha256
import ecdsa
DEBUG = True
DEBUG = False
"""
# secp256k1 T = (p, a, b, G, n, h)
/*
Reddit DailyProgrammer Challenge #180 -- Tamagotchi Emulator
By Aerospark12 (aka Luke)
I may have gone a little bit overboard with this one, but I've got fond memories of tamagotchi from when
I was but a wee laddie, I've always wanted to make something like this, and I really enjoy graphics and animation
The design of this is partially inspirte by how I understand "low level" ICs to work, as an homage to the real tamagotchi
<!-- plug-in configuration to put into your parent POM for avoiding any usages of outdated log4j2 versions,
some of which are subject to the RCE CVE-2021-44228 ("Log4Shell") -->
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>ban-bad-log4j-versions</id>