Skip to content

Instantly share code, notes, and snippets.

View seansummers's full-sized avatar
:octocat:
South Bend, IN

Sean Summers seansummers

:octocat:
South Bend, IN
View GitHub Profile
@ppoffice
ppoffice / asn1.py
Last active December 19, 2023 18:13
Textbook/RAW RSA & RSA with OAEP+SHA1+MGF1 Python Implementation
from typing import Tuple
import pyasn1.codec.der.encoder
import pyasn1.type.univ
import base64
import rsa
def private_key_pem(n: int, e: int, d: int, p: int, q: int, dP: int, dQ: int, qInv: int) -> str:
'''Create a private key PEM file
@dekassegui
dekassegui / sqlite_string_split.sql
Last active December 3, 2022 19:35
SQlite only -- snippet to demonstrate how to SPLIT STRING in substrings separated with custom separators.
with separators as ( values (' '), (','), ('-'), ('.') ),
source (s) as ( select " Will, thought and action." ),
bag (q) as ( -- POSITIONS OF ALL SEPARATORS
with dim (len) as ( select length(s) from source ),
ndx (n) as (
select 1 union all select n+1 from ndx, dim where n < len
) select 0 --> PSEUDO SEPARATOR IN FRONT OF SOURCE STRING
union all select n from ndx, source where substr(s, n, 1) in separators
union all select len+1 from dim --> PSEUDO SEPARATOR AT BOTTOM
),
@dannguyen
dannguyen / README.md
Last active September 26, 2021 04:20
Using just pure SQLite, create a tidy and normalized table from a recordset in which some columns contain multiple delimited values. Kudos to Samuel Bosch for this solution http://www.samuelbosch.com/2018/02/split-into-rows-sqlite.html

Pure SQLite solution to creating a tidy/normalized data table from a column of delimited values

The problem: we have a data table in which one of the columns contains a text string that is meant to be multiple values separated by a delimiter (e.g. a comma). For example, the LAPD crime incidents data has a column named MO Codes (short for modus operandi). Every incident may have several MO's -- for example, a particular RESISTING ARREST incident may have a MO Codes value of 1212 0416, which corresponds, respectively, to: LA Police Officer and Hit-Hit w/ weapon:

![image](https://user-ima

@trexx
trexx / onc_converter.py
Last active March 13, 2023 11:23
The .ovpn to .onc converter
#!/usr/bin/python
# The .ovpn to .onc converter
# This tool parses an 'inline' OpenVPN profile (certs and keys are included within the .ovpn file)
## and spits out a Open Network Configuration file which can be imported in to ChromeOS.
# Open Network Configuration specs can be found here
## https://chromium.googlesource.com/chromium/src/+/master/components/onc/docs/onc_spec.md
# Original credit goes to Steve Woodrow (https://github.com/woodrow)
@pbzona
pbzona / vpn-cloudformation-template.yaml
Created November 14, 2017 23:43
Roll your own VPN with AWS CloudFormation - Part two
# Credit to John Creecy
# Original can be found at https://gist.github.com/zugdud/f5453af2c827eba38bb036b19e10b371
AWSTemplateFormatVersion: '2010-09-09'
Description: OpenVPN Stack
Parameters:
OpenVPNPort:
Type: Number
Default: 1194
@ammgws
ammgws / edgerouter_lite_openvpn.md
Last active April 16, 2023 05:04
Notes on setting up OpenVPN on Edgerouter Lite

My notes on how I setup OpenVPN server on Edgerouter Lite. Based mostly on this guide from openVPN wiki. This guide assumes easyrsa3 is being used, otherwise substitute whatever the easyrsa2 versions are for the commands below.

This guide will use 3 different machines.

A Public Key Infrastructure (PKI) will be created on each machine:

    1. Server - openVPN server (Edgerouter in this case).
    1. Client(s) - the device(s) you will be connecting from.
    1. CA Server - used to generate and sign certificates for server and clients to use.
@lucasrcosta
lucasrcosta / awslambda.bootstrap.py
Last active October 26, 2021 12:06
AWS Lambda Python Runtime
# -*- coding: utf-8 -*-
# /var/runtime/awslambda/bootstrap.py
"""
aws_lambda.bootstrap.py
Amazon Lambda
Copyright (c) 2013 Amazon. All rights reserved.
Lambda runtime implemention
"""
@mojodna
mojodna / 0_register_planet.sql
Last active May 18, 2022 17:51
Sample OSM Athena queries
--
-- This will register the "planet" table within your AWS account
--
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
@jdmar3
jdmar3 / onc_converter.py
Last active September 7, 2018 17:33 — forked from woodrow/onc_converter.py
Convert OpenVPN config files to ChromeOS ONC files
#!/usr/bin/python
import argparse
import json
import re
import sys
import uuid
class OpenVPNNetworkConfiguration(object):
@jlinoff
jlinoff / mycrypt.py
Last active April 2, 2024 13:28
Simple python tool that demonstrates openssl -aes-256-cbc compatible encrypt/decrypt.
#!/usr/bin/env python
'''
Implement openssl compatible AES-256 CBC mode encryption/decryption.
*********************************
UPDATE: 2021-08-28
Apparently this no longer works out of the box. That is probavbly because the
pycrypto package is getting stale.
I found this hacky workaround to get things working but it is likely not safe: