Skip to content

Instantly share code, notes, and snippets.

@visar
visar / gcrgc.sh
Created November 7, 2018 12:55 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@visar
visar / SecretMessage.exs
Created January 8, 2018 22:23 — forked from rob-brown/SecretMessage.exs
Encode secret messages into text using zero-width spaces
defmodule SecretMessage do
@zero "\u200C"
@one "\u200D"
def encode(text, secret) when byte_size(text) > byte_size(secret) do
secret
|> obfuscate
|> Stream.concat(Stream.repeatedly fn -> "" end)
|> Stream.zip(String.codepoints text)
@visar
visar / ssl-check.py
Created December 12, 2017 23:39 — forked from gdamjan/ssl-check.py
Python script to check on SSL certificates
# -*- encoding: utf-8 -*-
# requires a recent enough python with idna support in socket
# pyopenssl, cryptography and idna
from OpenSSL import SSL
from cryptography import x509
from cryptography.x509.oid import NameOID
import idna
from socket import socket
@visar
visar / .travis.yml
Created December 6, 2017 11:19 — forked from b1ackmartian/.travis.yml
Travis CI Gigalixir Deploy
language: elixir
elixir: 1.5.2
otp_release: '19.0'
script:
- mix test && ./deploy.sh
@visar
visar / map_difference.ex
Created September 28, 2017 07:59 — forked from boydm/map_difference.ex
Elixir meyers_difference for Maps
defmodule Boydm.Utilities.Map do
#============================================================================
# similar to List.meyers_difference, the below code compares two maps
# and generates a list of actions that can be applied to the first map
# to transform it into the second map.
#--------------------------------------------------------
def difference(map_1, map_2) when is_map(map_1) and is_map(map_2) do
# remove any keys from map_1 that are simply not present (at all) in map_2
@visar
visar / README.md
Created November 15, 2016 11:53 — forked from gdamjan/README.md
Gtalk ⇄ xmpp gateway - learning contest!

Gtalk ⇄ xmpp gateway

Do it in any language you want to learn. The prize is knowledge!

Some of the more interesting would be Erlang, Elixir, Lua, Rust, Go, Haskell, Ocaml, but also anything more exotic than theese (OTOH an PHP version would be really crazy exotic for this kind of an app).

Connects to gtalk as an xmpp or hangouts (protobufs) client. Connects to my prosody as an xmpp component and forwards messages to my one single account.

@visar
visar / latency.markdown
Created October 9, 2016 07:14 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@visar
visar / beezid_scraper.py
Created August 22, 2016 12:06 — forked from CuriousGnu/beezid_scraper.py
Beezid.com - Auction Scraper
import pycurl
import json
import time
from StringIO import StringIO
i = 0
bnums = []
while True :
print(str(i))
urls = ["http://www.google.com", "http://www.bing.com", "http://www.yahoo.com"]
for_tasks = for {url, i} <- Enum.with_index(urls) do
Task.async(fn ->
:timer.sleep(3000 * i)
IO.puts("for ##{i}: #{url}")
end)
end
map_tasks = urls
Verifying that +visarz is my blockchain ID. https://onename.com/visarz