Skip to content

Instantly share code, notes, and snippets.

View iamd3vil's full-sized avatar
🎯
Focusing

Sarat Chandra iamd3vil

🎯
Focusing
View GitHub Profile
@iamd3vil
iamd3vil / client.conf
Created July 27, 2020 04:55
Wireguard on FreeBSD with pf
[Interface]
PrivateKey = ***********************
Address = 192.168.10.2/32, fc::2/128
DNS = 1.1.1.1, 2606:4700:4700::1111
[Peer]
PublicKey = ***********************
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = endpoint.domain.tld:51820

Keybase proof

I hereby claim:

  • I am iamd3vil on github.
  • I am iamd3vil (https://keybase.io/iamd3vil) on keybase.
  • I have a public key ASDAjwrYSjnfoR8qJCumiKU9owcbuym5oHVee3SHqCvAaAo

To claim this, I am signing this object:

-module(czmq_const).
-compile(export_all).
-include_lib("czmq/include/czmq.hrl").
zmq_pair() ->
?ZMQ_PAIR.
zmq_pub() ->
?ZMQ_PUB.
@iamd3vil
iamd3vil / hmac_elixir.ex
Created February 23, 2016 18:14
Hmac in Elixir
secret_key = "secret-key"
text = "This is a secret"
hmac = :crypto.hmac(:sha, secret_key, text)
|> Base.encode16
|> String.downcase
IO.puts "HMAC is #{hmac}" # HMAC is 08dc7014b3e778a44af52ea7a16a973a9b48f0dd
@iamd3vil
iamd3vil / hmac_python.py
Last active February 23, 2016 18:20
hmac_python.py
import hashlib
import hmac
secret_key = b"secret-key"
text = b"This is a secret"
hmac_sha1 = hmac.HMAC(key=secret_key, msg=text, digestmod=hashlib.sha1).hexdigest()
print("HMAC is {}".format(hmac_sha1)) # HMAC is 08dc7014b3e778a44af52ea7a16a973a9b48f0dd
@iamd3vil
iamd3vil / advent1.exs
Created December 9, 2015 14:25
Advent of code day 1 solution in Elixir
defmodule Advent1 do
def part1("(" <> rest, count) do
part1(rest, count + 1)
end
def part1(")"<> rest, count) do
part1(rest, count - 1)
end
def part1("", count), do: count
@iamd3vil
iamd3vil / advent2.exs
Created December 4, 2015 19:44
Advent of Code Day 2 code in Elixir
defmodule Advent2 do
def run(input) do
total_area = input
|> File.read!
|> String.split("\n", trim: true)
|> Enum.map(&calc_area/1)
|> Enum.reduce(0, &(&1 + &2))
IO.puts "Total area - part 1: #{total_area}"
total_ribbon = input
@iamd3vil
iamd3vil / phoenix showdown rackspace onmetal io.md
Created October 9, 2015 06:17 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)