This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <initializer_list> | |
#include <iostream> | |
#include <memory> | |
#include <string> | |
// Example base type | |
class Base | |
{ | |
public: | |
Base(const double a, const double b) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/env python | |
class Rectangle: | |
"""All rectangle methods are constant time.""" | |
def __init__(self, x1, y1, x2, y2): | |
"""Opposite corners of a rectangle. | |
These points will not be changed once set.""" | |
assert(x1 != x2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
/******* Lib start *****/ | |
class BaseVisitor { | |
public: | |
virtual ~BaseVisitor(){} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.hackerrank.com/contests/code-golf-challenges/challenges/leibniz | |
0.7266 | |
f=lambda:range(int(input())) | |
for _ in f():print(sum((-1)**i/(2*i+1) for i in f())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.albertgao.xyz/2016/09/28/how-to-use-valgrind-on-windows/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 | |
if [[ -f ~/.dir_colors ]] ; then | |
eval $(dircolors -b ~/.dir_colors) | |
elif [[ -f /etc/DIR_COLORS ]] ; then | |
eval $(dircolors -b /etc/DIR_COLORS) | |
fi | |
alias ls='ls --color=auto' | |
alias grep='grep --colour=auto' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <time.h> | |
#include <string.h> | |
/** | |
* Test to see how fast it takes to fund the sum of | |
* the digits of an integer. | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
int main(){ | |
int ret = system("rm backup.c a.out"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; close all; clc; | |
W = 2; | |
Fs = 100; % frequency meant to replicate continuous data | |
t = 0:1/Fs:W-1/Fs; | |
N = length(t); | |
x = cos(2*pi*t); | |
% Sampled x | |
fs = 20; % sampling frequency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; close all; clc; | |
W = 5; | |
fs = 100; | |
t = -W:1/fs:W; | |
N = length(t); | |
x = cos(2*pi*t); | |
% Fourier transform | |
bin_inc = fs/N; |
NewerOlder