Skip to content

Instantly share code, notes, and snippets.

@bitplus
bitplus / server_certificates_to_pem.md
Created July 4, 2012 07:02 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@bitplus
bitplus / aria2.bat
Created November 6, 2017 01:41 — forked from aa65535/aria2.bat
Aria2的配置文件 & 启动脚本
:: 启动后需要保留窗口, 关闭窗口则结束进程
aria2c --conf-path=aria2.conf -D
@bitplus
bitplus / unwxapkg.py
Created January 1, 2018 06:54 — forked from feix/unwxapkg.py
#!/usr/bin/env python2
# usage python2 unwxapkg.py filename
import sys, os
import struct
class WxapkgFile(object):
nameLen = 0
name = ""
{"sig":"b04bd0f79c6599507d007e61288730938f3d5b8a85b9991b2e96a4533361f041423f55b9a837d9a1685225dc967ae6ba0f566c544224c2802c4597e63fa960c41","msghash":"9392e0edfca4db20cc933b92907a6f50a6c6c6cadd1bf48c00b6ab0df9295c7b"}
@bitplus
bitplus / Office_kms
Created April 22, 2019 08:18 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
cd\Program Files\Microsoft Office\Office16
cd\Program Files (x86)\Microsoft Office\Office16
cscript OSPP.VBS /sethst:kms.digiboy.ir
cscript OSPP.VBS /actcscript OSPP.VBS /dstatus
slmgr.vbs /ckms
@bitplus
bitplus / content.md
Created July 2, 2020 08:34 — forked from baymaxium/content.md
小程序实现BLE蓝牙连接

原文:全栈笔记

自从微信小程序提供BLE蓝牙api后,网上随便一搜便是各种称实现了小程序连接ble 的功能的文章,上来就贴代码,贴效果图,对于我们这种没有与硬件开发打过交道的互联网开发者,单单看这些文章与小程序api 离自己真正调通还是有一段距离的。网上实现小程序连接BLE的文章太多了,此文不再贴整体实现代码,侧重于BLE的特征及开发中遇到的一些小细节(细节虽小,一点不通很难进行下一步)

一、BLE特征

1、BLE(Bluetooth Low Energy),蓝牙4.0核心profile,主要特点是快速搜索,快速连接,超低功耗保持连接和数据传输,缺点:数据传输速率低,由于其具有低功耗特点,所以经常用在可穿戴设备之中。

2、关于数据传输:每个设备包含了多个service(可以理解为服务)。每个service 同时又包含了多个characteristic特征值,每一个具体的characteristic特征值才是BLE通信的主要通道。BLE主机与从机均是通过characteristic来进行通信。

@bitplus
bitplus / Program.cs
Created September 28, 2021 14:25 — forked from ovrmrw/Program.cs
Topshelf + OWIN Self-Host + ASP.NET WebAPI + Ninject
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Tracing;
using System.Reflection;
using Owin;
@bitplus
bitplus / README.md
Created June 2, 2022 06:47 — forked from lxe/README.md
Disco Diffusion Tips