Skip to content

Instantly share code, notes, and snippets.

View ryanwinchester's full-sized avatar
⚗️
Working on open-source and side projects

Ryan Winchester ryanwinchester

⚗️
Working on open-source and side projects
View GitHub Profile
@ryanwinchester
ryanwinchester / 1brc.exs
Last active March 18, 2024 15:11 — forked from ethanniser/1brc.exs
1 billion row challenge in a SINGLE EXPRESSION!
Mix.install([
{:explorer, "~> 0.8.0"}
])
filepath = "./measurements.txt"
defmodule Challenge do
import Explorer.Series
require Explorer.DataFrame, as: DF
@ryanwinchester
ryanwinchester / bench.ex
Created October 3, 2022 22:52 — forked from moogle19/bench.ex
Masking benchmark
defmodule Bench do
def orig(payload, mask) do
maskstream = <<mask::32>> |> :binary.bin_to_list() |> Stream.cycle()
payload
|> :binary.bin_to_list()
|> Enum.zip(maskstream)
|> Enum.map(fn {x, y} -> Bitwise.bxor(x, y) end)
|> :binary.list_to_bin()
end
@ryanwinchester
ryanwinchester / twittermute.txt
Created May 11, 2021 22:36 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@ryanwinchester
ryanwinchester / gencert.sh
Created December 27, 2019 21:30 — forked from crpietschmann/gencert.sh
OpenSSL Generate 4096-bit Certificate (Public/Private Key Encryption) with SHA256 Fingerprint
# 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 December 26, 2019 08:30 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
#!/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 / PHP-Guzzle.php
Last active January 19, 2021 00:18 — forked from bkilshaw/gist:3624901
MACVendors.com API :: V1 Code Samples
<?php
// PHP using Guzzle example
use GuzzleHttp\Client;
$client = new Client();
$mac_address = "FC:FB:FB:01:FA:21";
@ryanwinchester
ryanwinchester / _hover_example.py
Created October 4, 2017 19:54 — forked from dankrause/_hover_example.py
Example code to use the (unofficial, unsupported, undocumented) hover.com DNS API.
import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/api/login", params=params)
@ryanwinchester
ryanwinchester / upgrade.md
Created March 2, 2017 06:53 — forked from chrismccord/upgrade.md
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behind those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

The Erlang VM only allows a limited set of expressions as guards:

  • comparison operators (==, !=, ===, !==, >, <, <=, >=);
  • boolean operators (and, or) and negation operators (not, !);
  • arithmetic operators (+, -, *, /);
  • <> and ++ as long as the left side is a literal;
  • the in operator;
  • all the following type check functions:
    • is_atom/1
  • is_binary/1
@ryanwinchester
ryanwinchester / codeship-elixir.sh
Created December 6, 2016 16:37 — forked from paulgoetze/codeship-elixir.sh
Codeship Elixir/Phoenix test setup
#!/bin/bash
# Erlang
ERLANG_VERSION=${ERLANG_VERSION:-19.0}
ERLANG_CACHED_DOWNLOAD="${HOME}/cache/OTP-${ERLANG_VERSION}.tar.gz"
ERLANG_DIR=${ERLANG_DIR:="$HOME/erlang"}
# Elixir
ELIXIR_VERSION=${ELIXIR_VERSION:-1.3.1}
ELIXIR_CACHED_DOWNLOAD="${HOME}/cache/elixir-v${ELIXIR_VERSION}.zip"