Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #!/bin/bash | |
| # generate new personal ed25519 ssh key | |
| ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>" | |
| # generate new host cert authority (host_ca) ed25519 ssh key | |
| # used for signing host keys and creating host certs | |
| ssh-keygen -t ed25519 -f manta_host_ca -C manta.network | |
| eval "$(ssh-agent -s)" |
| use HTML::FromANSI (); | |
| open (LOG, '>>hnchatlog.html'); | |
| select((select(LOG), $|=1)[0]); | |
| print LOG "<body bgcolor=black>\n"; | |
| while (<>) { | |
| my $h = HTML::FromANSI->new(); | |
| print LOG $h->ansi_to_html($_), "\n"; | |
| } |
| require 'CSV' | |
| class ImportCSV | |
| class << self | |
| def parse csv_file | |
| CSV::Converters[:blank_nil] = lambda do |field| | |
| field && field.empty? ? nil : field | |
| end | |
| csv_data = CSV.read(csv_file, :headers => true, | |
| :header_converters => :symbol, | |
| :converters => [:all, :blank_nil]) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
| defmodule SecureRandom do | |
| @moduledoc """ | |
| Ruby-like SecureRandom module. | |
| ## Examples | |
| iex> SecureRandom.base64 | |
| "xhTcitKZI8YiLGzUNLD+HQ==" | |
| iex> SecureRandom.urlsafe_base64(4) |
#HW 1-2: Rock-Paper-Scissors
In a game of rock-paper-scissors (RPS), each player chooses to play Rock (R), Paper (P), or Scissors (S). The rules are: R beats S; S beats P; and P beats R. We will encode a rock-paper-scissors game as a list, where the elements are themselves 2-element lists that encode a player's name and a player's selected move, as shown below:
[ ["Armando", "P"], ["Dave", "S"] ] # Dave would win since S > P Part A: Write a method rps_game_winner that takes a two-element list and behaves as follows:
If the number of players is not equal to 2, raise WrongNumberOfPlayersError.
| [alias] | |
| lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit |
| # Fun exercise with Elixir. | |
| # The joke's on arabic tech news and yes it's that bad I had to write this. | |
| # That's an elixir script hence .exs so run it with | |
| # > elixir kill_braincells.exs | |
| defmodule Content do | |
| @moduledoc """ | |
| Content is responsible for consuming different types of content | |
| """ |
| #! /usr/bin/env ruby | |
| date_of_birth = Time.new(1988, 8, 31) | |
| # Credit: http://stackoverflow.com/a/4136485 | |
| def humanize seconds | |
| [[60, :seconds], | |
| [60, :minutes], | |
| [24, :hours], | |
| [365, :days], |