Skip to content

Instantly share code, notes, and snippets.

💻
Working at work and at home

Ryan Winchester ryanwinchester

💻
Working at work and at home
Block or report user

Report or block ryanwinchester

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blur.ex
import Enum;c=String.replace("example string",~r/[\W_]/,"")|>String.split("",trim: true);zip(c,slice(c,1..-1))|>map(fn{a,b}->a<>b end)|>join(" ") end end
View AWS-CodeDeploy.md
@ryanwinchester
ryanwinchester / gencert.sh
Created Dec 27, 2019 — forked from crpietschmann/gencert.sh
OpenSSL Generate 4096-bit Certificate (Public/Private Key Encryption) with SHA256 Fingerprint
View gencert.sh
# Generate Private Key and Certificate using RSA 256 encryption (4096-bit key)
openssl req -x509 -newkey rsa:4096 -keyout privatekey.pem -out certificate.pem -days 365
# Alternatively, setting the "-newkey" parameter to "rsa:2048" will generate a 2048-bit key.
# Generate PKCS#12 (P12) file for cert; combines both key and certificate together
openssl pkcs12 -export -inkey privatekey.pem -in certificate.pem -out cert.pfx
# Generate SHA256 Fingerprint for Certificate and export to a file
openssl x509 -noout -fingerprint -sha256 -inform pem -in certificate.pem >> fingerprint.txt
@ryanwinchester
ryanwinchester / gen-ca.sh
Last active Dec 26, 2019 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gen-ca.sh
#!/bin/bash
###### PICK ONE OF THE TWO FOLLOWING ######
# OPTION ONE: RSA key. these are very well-supported around the internet.
# you can swap out 4096 for whatever RSA key size you want. this'll generate a key
# with password "xxxx" and then turn around and re-export it without a password,
# because genrsa doesn't work without a password of at least 4 characters.
#
# some appliance hardware only works w/2048 so if you're doing IOT keep that in
@ryanwinchester
ryanwinchester / remote-node.sh
Created Sep 5, 2018
You can run observer locally for a remote node
View remote-node.sh
#!/bin/sh
set -e
BEAM_PORT=32815
EPMD_PORT=4369
COOKIE='cookiestring'
ssh -f -o ExitOnForwardFailure=yes \
-L "$EPMD_PORT:localhost:$EPMD_PORT" \
@ryanwinchester
ryanwinchester / poker.exs
Last active May 15, 2018
Just having fun...
View poker.exs
defmodule Poker do
@deck ~w(
A♣ 2♣ 3♣ 4♣ 5♣ 6♣ 7♣ 8♣ 9♣ 10♣ J♣ Q♣ K♣
A◆ 2◆ 3◆ 4◆ 5◆ 6◆ 7◆ 8◆ 9◆ 10◆ J◆ Q◆ K◆
A♠ 2♠ 3♠ 4♠ 5♠ 6♠ 7♠ 8♠ 9♠ 10♠ J♠ Q♠ K♠
A♥ 2♥ 3♥ 4♥ 5♥ 6♥ 7♥ 8♥ 9♥ 10♥ J♥ Q♥ K♥
)
def deck, do: Enum.with_index(@deck)
@ryanwinchester
ryanwinchester / fib.exs
Last active Apr 3, 2018
Fibonacci Solution
View fib.exs
defmodule Fibonacci do
def fib(0), do: 0
def fib(1), do: 1
def fib(n), do: fib(n-1) + fib(n-2)
end
View stop keybase from auto launching.sh
keybase uninstall --components service
@ryanwinchester
ryanwinchester / PHP-Guzzle.php
Last active Jan 3, 2019 — forked from bkilshaw/gist:3624901
MACVendors.com API :: V1 Code Samples
View PHP-Guzzle.php
<?php
// PHP using Guzzle example
use GuzzleHttp\Client;
$client = new Client();
$mac_address = "FC:FB:FB:01:FA:21";
View 01-original.md

Here’s an example of an list comprehension in Haskell from Wikipedia:

a = [(x,y) | x <- [1..5], y <- [3..5]]
-- [(1,3),(1,4),(1,5),(2,3),(2,4) ...

In this example, a list of pair of integers is constructed from 2 lists of integers.

Here is what that example would be in Python:

You can’t perform that action at this time.