Skip to content

Instantly share code, notes, and snippets.

@stevenhaddox
stevenhaddox / server_certificates_to_pem.md
Last active May 8, 2024 07:13
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 hostname.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 hostname.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

@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@itsderek23
itsderek23 / Dockerfile
Created August 27, 2013 02:09
Example Docker File to start a Rails app located in a local ./docker-rails directory.
# docker build -t="rails" .
FROM ubuntu:12.04
RUN apt-get update
## MYSQL
RUN apt-get install -y -q mysql-client libmysqlclient-dev
## RUBY
@davidebbo
davidebbo / wfastcgi.py
Last active April 6, 2017 10:17
wfastcgi.py file that's compatible with Python 3.x. It is preliminary and not well tested.
# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you cannot locate the Apache License, Version 2.0, please send an email to
# vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
# by the terms of the Apache License, Version 2.0.
#
@manishtpatel
manishtpatel / main.go
Last active October 18, 2023 03:12
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@jonmorehouse
jonmorehouse / tar.go
Created February 17, 2014 22:29
Quick golang script for creating a gzipped tarball
package main
import (
"os"
"archive/tar"
"log"
"io"
"compress/gzip"
)
@sayedihashimi
sayedihashimi / _webjob-env-vars.txt
Last active August 1, 2022 02:46
Environment variables when your app is running as a Microsoft Azure Web Job
ALLUSERSPROFILE C:\DWASFiles\Sites\WebjobsEnvvars\ProgramData
APP_POOL_CONFIG C:\DWASFiles\Sites\WebjobsEnvvars\Config\applicationhost.config
APP_POOL_ID WebjobsEnvvars
APPDATA C:\DWASFiles\Sites\WebjobsEnvvars\AppData
APPSETTING_REMOTEDEBUGGINGVERSION 11.0.611103.400
APPSETTING_ScmType None
APPSETTING_WEBSITE_NODE_DEFAULT_VERSION 0.10.29
APPSETTING_WEBSITE_SITE_NAME WebjobsEnvvars
aspnet:DisableFcnDaclRead true
aspnet:PortableCompilationOutput true
@sahal
sahal / proxy.pac
Last active June 5, 2021 15:17
Proxy Auto Configuration - SOCKS5 Sample
// see: http://blog.sahal.info/post/58278726443/chromebook-socks-proxies-and-ssh-tunnels
function FindProxyForURL(url, host)
{
// On my Chromebook, I've found that "Secure Shell" or Chrome itself doesn't close ports after a session timesout
// so I have to switch the local proxy listen address to 8081. Now, I don't have to use two proxy.pac files.
// See Simple PAC Load Balancing on proxypacfiles.com
// http://www.proxypacfiles.com/proxypac/index.php?option=com_content&view=article&id=63&Itemid=104
// https://web.archive.org/web/20131011081101/http://www.proxypacfiles.com/proxypac/index.php?option=com_content&view=article&id=63&Itemid=104
return "SOCKS5 localhost:8080; SOCKS5 localhost:8081";
}
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active July 9, 2024 15:53
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@jokecamp
jokecamp / gist:2c1a67b8f277797ecdb3
Last active January 31, 2024 01:48
Powershell HMAC SHA 256 Example
# Powershell HMAC SHA 256
$message = 'Message'
$secret = 'secret'
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256
$hmacsha.key = [Text.Encoding]::ASCII.GetBytes($secret)
$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message))
$signature = [Convert]::ToBase64String($signature)