Skip to content

Instantly share code, notes, and snippets.

View valep27's full-sized avatar

Valerio Pipolo valep27

  • Amsterdam, NL
View GitHub Profile
fn main() {
let n = 10000000;
println!("Let's print prime numbers up to {}", n);
let primes = sieve(n);
for i in primes {
print!("{} ", i);
}
}
@valep27
valep27 / spiral_lr.cpp
Last active August 29, 2015 14:28
Matrix traversal in spiral order (left to right)
vector<int> spiralOrder(const vector<vector<int>> &A) {
vector<int> result;
int i = 0, j = 0;
int startI = 0, startJ = 1;
int rows = A.size();
int cols = A[0].size();
int total = rows*cols;
while (result.size() < total) {
// over a row
@valep27
valep27 / glium_front.rs
Last active March 3, 2016 22:10
The glium example refactored.
use glium::{DisplayBuild, Surface, VertexBuffer, Program};
use glium::backend::glutin_backend::GlutinFacade;
use glium::{glutin, index, uniforms};
extern crate glium;
/// A trait for graphical frontends.
/// Normally, the only thing that the cpu does is send the framebuffer data.
pub trait GpuFrontend {
/// Displays one frame of data from the raw framebuffer.
@valep27
valep27 / RSAKeys.cs
Created December 13, 2017 09:44 — forked from therightstuff/RSAKeys.cs
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{