Skip to content

Instantly share code, notes, and snippets.

View razimantv's full-sized avatar

Raziman T V razimantv

  • Imperial College London
  • London, United Kingdom
  • 11:58 (UTC +01:00)
  • X @razimantv
View GitHub Profile
@razimantv
razimantv / Pi_MC.ipynb
Created October 4, 2018 12:37
Monte Carlo estimation of Pi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / ImpossiblePuzzle.ipynb
Last active October 4, 2018 00:50
Programmatic solution to the "Impossible puzzle"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / battleship.cpp
Created February 25, 2018 23:19
Given the shape of a ship and the location of one cell, bomb the remaining cells in minimum attempts
#include <iostream>
#include <map>
#include <random>
#include <tuple>
#include <vector>
std::random_device rd;
std::mt19937 gen(rd());
typedef std::vector<std::string> pattern;
@razimantv
razimantv / covfefe.ipynb
Created January 5, 2018 10:51
Solving the covfefe problem
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / circles.cpp
Created December 30, 2017 11:52
Convert an image into one made out of coloured circles with mean pixel values
#include <algorithm>
#include <cmath>
#include <iostream>
#include <random>
#include <string>
#include <vector>
// RGB values
// Add arithmetic operations to take means squared deviations
struct rgb {
@razimantv
razimantv / solarirradiance.cpp
Last active December 21, 2017 13:23
Compute total solar irradiance at different latitudes on different days
/* solar.cpp: Calculates the solar energy received by places at different
* latitudes over the year. It is assumed that the earth revolves around the
* sun in a circular orbit taking exactly 365 days
*
* Author: Raziman T V
*
* License:
* You may use this document for whatever purpose you desire, as long as the
* following conditions are satisfied:
* 1) You do not use it in a way that suggests that I endorse the use.
@razimantv
razimantv / primes.py
Created December 10, 2017 21:44
Prime tree elements
primes = [2, 3, 5, 7]
parent = [-1, -1, -1, -1]
digits = [1, 3, 7, 9]
def isprime(N):
i = 2
while i * i <= N:
if N % i == 0:
return False
i += 1
@razimantv
razimantv / prisonersubset.cpp
Created November 21, 2017 18:24
Subset-based solution to the 3-prisoner number sum problem
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <vector>
typedef std::vector<int> triplet;
// List all ways to choose K-element subsets of an N-element vector
// By abusing next_permutation
"" vimrc file
" contains settings for vim and gvim
"Vundle=========================================================================
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'mileszs/ack.vim'
Plugin 'vim-scripts/Conque-GDB'
@razimantv
razimantv / tmux.conf
Last active April 10, 2017 20:31
Tmux configuration
set -g default-terminal "screen-256color"
set -g update-environment "TERM_PROGRAM"
bind C-y run "tmux save-buffer - | xclip -selection clipboard"
set -g mouse on
# Toggle mouse on with ^B m
bind m \
set -g mouse on \;\
display 'Mouse: ON'