Skip to content

Instantly share code, notes, and snippets.

View Najaf's full-sized avatar

Ali Najaf

View GitHub Profile

I'm Daven, a Canadian and aspiring developer living in Japan.

Background

  • B.A. Economics: University of Waterloo (2008-2012)
  • Study abroad at Ritsumeikan APU (立命館アジア太平洋大学)
  • English teacher for 8 years

Projects

@Najaf
Najaf / bwt.rb
Created May 2, 2017 16:32
Rough implementation of Burrows-Wheeler
# Rough implementation of BW transform
# As described at the wikipedia page: https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform
EOF_CHAR = '|'
def bwt(string)
string_with_eof = string + EOF_CHAR
rotations = []
0.upto(string_with_eof.length - 1) do |i|
rotations << string_with_eof.chars.rotate(i).join

Keybase proof

I hereby claim:

  • I am Najaf on github.
  • I am alinajaf (https://keybase.io/alinajaf) on keybase.
  • I have a public key whose fingerprint is 989E 6487 8C4A CDA3 0AF0 0A5B F7B3 0CFC 4514 0684

To claim this, I am signing this object:

extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
println!("Guess the number!");
@Najaf
Najaf / SECURITY.md
Last active September 10, 2015 19:31

Security inspections

At the beginning of each month, we carry out a brief, high-level security inspection. The purpose is to be a sanity check for head-slapping, trivial vulnerabilities that no one expected would be in the code but somehow managed to creep in anyway.

Who's responsible?

One of @alice, @bob or @charlie should do the inspection if no one else has the time.

How often?

#! /usr/bin/env ruby
require 'socket'
def log(source, message)
time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
puts "[%s] %s => %s" % [time, source, message]
end
# Class representing HTTP Requests
#! /usr/bin/env ruby
require 'socket'
def log(source, message)
time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
puts "[%s] %s => %s" % [time, source, message]
end
# Class representing HTTP Requests
#! /usr/bin/env ruby
require 'socket'
def log( source, message)
time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
puts "[%s] %s => %s" % [time, source, message]
end
server = TCPServer.new ARGV.first.to_i
#! /usr/bin/env ruby
require 'socket'
def log(source, message)
time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
puts "[%s] %s => %s" % [time, source, message]
end
server = TCPServer.new ARGV.first.to_i
#! /usr/bin/env ruby
require 'socket'
server = TCPServer.new ARGV.first.to_i
loop do
client = server.accept
client.write(client.readline)
client.close