Skip to content

Instantly share code, notes, and snippets.

@PSJoshi
PSJoshi / networking_datasets.md
Created August 30, 2023 05:21 — forked from stefanbschneider/networking_datasets.md
List of datasets related to networking. Useful for data-driven evaluation or machine learning approaches. Feel free to comment with updates.
@PSJoshi
PSJoshi / OpenSSL.md
Created April 8, 2021 09:39 — forked from mohanpedala/OpenSSL.md
OpenSSL Working with SSL Certificates, Private Keys, CSRs and Truststores

Generate a private key and a CSR(Certificate Signing Request )

Use this method if you want to use HTTPS (HTTP over TLS) to secure your Apache HTTP or Nginx web server, and you want to use a Certificate Authority (CA) to issue the SSL certificate. The CSR that is generated can be sent to a CA to request the issuance of a CA-signed SSL certificate. If your CA supports SHA-2, add the -sha256 option to sign the CSR with SHA-2.

Creating a 2048-bit private key (domain.key) and a CSR (domain.csr) from scratch:

openssl req -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr

Creating a 2048-bit private key and public key

@PSJoshi
PSJoshi / popen.md
Created January 30, 2019 12:22 — forked from achillesrasquinha/popen.md
A Python Popen that does not suck.

A Python Popen that does not suck.

Function

import os
import subprocess

def popen(*args, **kwargs):
    output      = kwargs.get('output', False)
    directory   = kwargs.get('dir')
@PSJoshi
PSJoshi / useragentswitcher.xml
Created November 16, 2015 05:12
Massive list of user agents for User Agent Switcher by Chris Pederik http://forums.chrispederick.com/categories/user-agent-switcher
<useragentswitcher>
<folder description="Browsers - Windows">
<folder description="Legacy Browsers">
<useragent description="Arora 0.6.0 - (Vista)" useragent="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.6 (Change: )" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Avant Browser 1.2" useragent="Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Chrome 4.0.249.0 (Win 7)" useragent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
<useragent description="Chrome 5.0.310.0 (Server 2003)" useragent="Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9" appcodename="" appname=""
input {
tcp {
type => "syslog"
host => "127.0.0.1"
port => 3514
}
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
@PSJoshi
PSJoshi / kmeans.py
Last active August 29, 2015 14:21 — forked from larsmans/kmeans.py
#!/usr/bin/python
#
# K-means clustering using Lloyd's algorithm in pure Python.
# Written by Lars Buitinck. This code is in the public domain.
#
# The main program runs the clustering algorithm on a bunch of text documents
# specified as command-line arguments. These documents are first converted to
# sparse vectors, represented as lists of (index, value) pairs.
from collections import defaultdict
#############################################################################
# Full Imports
import sys
import math
import random
import subprocess
"""
This is a pure Python implementation of the K-Means Clustering algorithmn. The