Skip to content

Instantly share code, notes, and snippets.

View arunlakshman's full-sized avatar

Arun Lakshman R arunlakshman

View GitHub Profile
@arunlakshman
arunlakshman / mincore.c
Created February 9, 2018 11:42
File Occupancy in Buffer Cache
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
struct Window {
number_str: String,
window_size: i32,
current: i32,
}
impl Iterator for Window {
type Item = u64;
fn next(&mut self) -> Option<u64> {
struct Fibonacci {
current: u64,
next: u64,
}
impl Iterator for Fibonacci {
type Item = u64;
fn next(&mut self) -> Option<u64> {
let t = self.current + self.next;
fn main() {
let range = 1..1000;
let result: i32 = range.filter(|num| num % 3 == 0 || num % 5 ==0).sum();
println!("{}",result)
}
@arunlakshman
arunlakshman / VolatileTest.java
Created August 6, 2017 07:29
Java Volatile Keyword
public class VolatileTest {
private static final int MAX_TASK_COUNT = 5;
private static volatile int tasks = 0;
public static void main(String[] args) {
new Employee().start();
new Manager().start();
}