Skip to content

Instantly share code, notes, and snippets.

View dbl0null's full-sized avatar
👁️‍🗨️

Sergey Shiganov dbl0null

👁️‍🗨️
  • Saint Petersburg, Russia
View GitHub Profile
@dbl0null
dbl0null / Howto convert a PFX to a seperate .key & .crt file
Created May 19, 2017 12:39 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@dbl0null
dbl0null / rpm-digital-signature.sh
Created May 19, 2017 12:39 — forked from fernandoaleman/rpm-digital-signature.sh
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@dbl0null
dbl0null / mdns_util.py
Created November 26, 2017 07:21 — forked from nickcoutsos/mdns_util.py
A wrapper class to simplify working with pybonjour in tornado.
"""
mdns_util
Provides a class to wrap pybonjour functionality and references to work
with Tornado's IOLoop for event handling.
Sample usage:
>>> from mdns_util import MDNS
>>> from tornado.ioloop import IOLoop
...
@dbl0null
dbl0null / gist:48c88f091076b68bfc70edaa984b6604
Created November 30, 2017 09:27 — forked from tzuryby/gist:975588
Stream handlers with Tornado
class StreamHandler(AMSHandler):
@tornado.web.asynchronous
def get(self):
self.post()
@tornado.web.asynchronous
def post(self):
self.write("<pre>")
self.ioloop = tornado.ioloop.IOLoop.instance()
self.pipe = self.get_pipe()
@dbl0null
dbl0null / gioloop.py
Created November 30, 2017 09:55 — forked from schlamar/gioloop.py
Tornado IOLoop implementation with gobject/gtk.
import datetime
import functools
import logging
import os
import time
import gobject
import gtk
@dbl0null
dbl0null / Makefile
Created November 30, 2017 09:57 — forked from minhoryang/Makefile
PEX Trial
PACKAGE=$(shell basename `pwd`) # ""
VERSION=$(shell git describe --tags) # ignorable
OUTPUT_NAME=$(PACKAGE)-$(VERSION)
.PHONY: build_pex
build_pex: clean $(OUTPUT_NAME).pex
.PHONY: prepare_pex
prepare_pex:
pip install --upgrade pip wheel pex
@dbl0null
dbl0null / datatype.py
Created November 30, 2017 10:04 — forked from kwlzn/datatype.py
python datatype factory
#!/usr/bin/env python2.7
import itertools
def datatype(type_name, params):
"""A faster/more efficient namedtuple replacement with better subclassing properties.
>>> RustLibrary = datatype('RustLibrary', ['sources', 'dependencies'])
>>> rl = RustLibrary([1,2,3], [4,5,6])
#!/usr/bin/env python
from collections import deque
class TaskGraph(object):
''' simple acyclic, directed property graph with iteration
use case:
1) model nodes as dicts and dependencies as directed edges (name=occ -> name=twist)
2) start with all nodes colored down (_st=0)
#!/bin/bash
# Checking if python is installed
if ! [ -x "$(command -v python)" ]; then
echo 'Error: python is not installed. :(' >&2
exit 1
fi
# Build directory
export OLDDIR=$PWD