Skip to content

Instantly share code, notes, and snippets.

View vasilescur's full-sized avatar

Radu Vasilescu vasilescur

View GitHub Profile
% Prolog Wordle Solver
% Author: Radu Vasilescu
green_valid(GreenLetter, WordLetter) :-
var(GreenLetter);
atom(GreenLetter), GreenLetter = WordLetter.
black_valid(Black, WordChars) :-
forall(member(B, Black),
\+ member(B, WordChars)).
namespace QuantConnect {
public class BasicTemplateAlgorithm: QCAlgorithm {
decimal lastPrice;
decimal DELTA = 3;
decimal AMOUNT = 1;
public override void Initialize() {
// backtest parameters
SetStartDate(2016, 1, 1);
@vasilescur
vasilescur / git.md
Created June 23, 2020 16:28
Git Cheatsheet

Git

Overview

Git is used for version control, and also for holding all our files.

  • It provides options to clone repositories (download them from online)
  • The repository is broken up into branches, a list of commits outlining the history
  • The typical workflow:
    • clone the repo
  • make sure you're on the master branch
module fpgatest(
input OSC_50_B7A, // 50 MHz clock
output [3:0] LED,
output [3:0] LED_BRACKET,
output LED_RJ45_L,
output LED_RJ45_R
);
assign clk_main = OSC_50_B7A;

Euler Totient Function - Programming Challenge

In this challenge, you will be writing a piece of code that generates the first N numbers in OEIS sequence A000010, the Euler totient function phi(n).

Definition

This sequence is defined as the "count of numbers <= n and prime to n." In other words, the value of the function for an input n is the count of numbers in {1, 2, 3, ..., n} that are relatively prime to n-- that is, the numbers whose GCD (Greatest Common Divisor) with n is 1.

Introduction

What is Huffman Encoding?

Huffman encoding is an algorithm devised by David A. Huffman of MIT in 1952 for compressing text data to make a file occupy a smaller number of bytes. This relatively simple compression algorithm is powerful enough that variations of it are still used today in computer networks, fax machines, modems, HDTV, and other areas. This challenge involves implementing a function that performs Huffman encoding, and one that performs Huffman decoding.

Normally text data is stored in a standard format of 8 bits per character using an encoding called ASCII that maps every character to a binary integer value from 0-255. The idea of Huffman encoding is to abandon the rigid 8-bits-percharacter requirement and use different-length binary encodings for different characters. The advantage of doing this is that if a character occurs frequently in the file, such as the common letter 'e', it could be given a shorter encoding (fewer bits), making the file smaller. The tradeoff is t

Enigma Challenge

The Enigma machine is a fairly complex cipher machine used by the Germans and others during World War II to encrypt their messages. The Enigma code was famously broken by Alan Turing during the war, using one of the world's first "computers". It is your job to implement this machine.

Step 1, Rotation

Our enigma machine has 3 slots for rotors, and 5 available rotors for each of these slots. Each rotor has 26 different possible positions (from A to Z). Each rotor has a predefined notch position:

Rotor Notch
@vasilescur
vasilescur / Duplicates.COBOL
Created March 6, 2019 16:49
ACSL Challenge #4
*> ***********************************************************************
*> NAME: RADU VASILESCU
*> SCHOOL: LOVELAND HIGH SCHOOL
*> DIVISION: SENIOR 5 DIVISION
*> PROGRAM: ACSL CONTEST #4 - DUPLICATES
*> ***********************************************************************
*> LANGUAGE: COBOL
*> COMPILER: GNUCOBOL 2.0RC2 FOR WINDOWS
*> NOTE: COMPILE WITH -FREE FLAG
*> ***********************************************************************