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
import numpy as np | |
import random | |
import plotly.graph_objects as go | |
from plotly.subplots import make_subplots | |
class GaussianDistribution: | |
def __init__(self, mean, sigma): | |
self.u = mean |
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
import cv2 | |
import numpy as np | |
import sys | |
import matplotlib.pyplot as plt | |
# Create a VideoCapture object and read from input file | |
# If the input is the camera, pass 0 instead of the video file name | |
cap = cv2.VideoCapture(sys.argv[1]) |
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
import pygame | |
import os | |
import random | |
import time | |
import sys | |
import subprocess | |
import ffmpeg | |
import shutil | |
pygame.init() |
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
import React, {useState} from "react"; | |
import {useInterval} from "../Common/timers"; | |
import Tick from '../static/sounds/tick.wav'; | |
export default function Metronome(props) | |
{ | |
let [delay, setDelay] = useState(1000); | |
let [startTime, setStartTime] = useState(null); | |
let [r, setR] = useState(255); |
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 <string> | |
template <int N> | |
struct ToBinaryString | |
{ | |
inline static std::string result() | |
{ | |
return ToBinaryString<N / 2>::result() + ((N & 1) == 0 ? "0" : "1"); | |
} |
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 <string> | |
#include <vector> | |
int main() | |
{ | |
// Some random data to play with. | |
const std::vector<std::string> a = {"This", "is", "sort", "of", "silly"}; | |
// We wish to print the data separated by spaces, but only print |
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 <algorithm> | |
#include <iostream> | |
int main() | |
{ | |
// Original data won't change order | |
const std::vector<int> data{1, 7, 3, 6, 4, 5, 2, 8, 0, 9}; | |
// The objective is to make `data[sortedIndices[i]]` represent | |
// the following pseudocode: `sorted(data)[i]`. |
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
void update(int x, int* sieve, std::map<int, int>& freq, int inc) | |
{ | |
while (x > 1) | |
{ | |
int factor = sieve[x]; | |
freq[factor] += inc; | |
x /= factor; | |
} | |
} |
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 <opencv.hpp> | |
#include <stdio.h> | |
#define PROFILE(function_name, ...) \ | |
{ \ | |
long long start = cv::getTickCount(); \ | |
function_name(__VA_ARGS__); \ | |
long long end = cv::getTickCount(); \ | |
double time_spent = (end - start) / cv::getTickFrequency(); \ |
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
import java.util.List; | |
import java.util.ArrayList; | |
public class Merge | |
{ | |
public static void main(String args[]) | |
{ | |
List<Integer> a = new ArrayList<Integer>(); | |
List<Integer> b = new ArrayList<Integer>(); |
NewerOlder