Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
sosukeinu / openssl.MD
Created January 12, 2018 22:18 — forked from jchandra74/openssl.MD
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.

Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:

Self-Signed SSL Issue in Chrome

# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@sosukeinu
sosukeinu / README.md
Created March 19, 2017 18:29 — forked from kchr/README.md
Python implementation: Convex hull + Minimal bounding rectangle

What is this?

Python proof-of-concept implementation of two geomapping algorithms

Requirements

This code use the following packages:

@sosukeinu
sosukeinu / python-daemon_apscheduler.py
Created January 30, 2017 01:17 — forked from timss/python-daemon_apscheduler.py
A combination of python-daemon and APScheduler
#!/usr/bin/env python
import apscheduler.scheduler
import daemon.runner
import os.path
import sys
import time
class Core():
def __init__(self):
@sosukeinu
sosukeinu / update_symbolic_links.sh
Created July 14, 2016 17:03
Update Symbolic Links from older versions of Homebrew Cask to new location so you don't have to re-install all of your apps. Please feel free to make improvements, as this was just kind of thrown together.
@sosukeinu
sosukeinu / blog_sparkline.js
Created January 16, 2016 14:27 — forked from rowanv/blog_sparkline.js
Gist to accompany my "How to make Tufte's discrete sparklines using d3.js" at http://dataviztalk.blogspot.com
var boston_record = [
['home', 'win'],
...
['away', 'loss'],
];
d3.select('#second-wrapper-main')
.selectAll('div')
.data(boston_record)
.enter().append('div')
CREATE OR REPLACE FUNCTION generate_object_id() RETURNS varchar AS $$
DECLARE
time_component bigint;
machine_id int := FLOOR(random() * 16777215);
process_id int;
seq_id bigint := FLOOR(random() * 16777215);
result varchar:= '';
BEGIN
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp())) INTO time_component;
SELECT pg_backend_pid() INTO process_id;
@sosukeinu
sosukeinu / useful_pandas_snippets.py
Created November 11, 2015 15:20 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
<?php
if ( is_singular('product') ) {
global $post;
// get categories
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $cats_array[] = $term->term_id;