Skip to content

Instantly share code, notes, and snippets.

View JVero's full-sized avatar

JVero

View GitHub Profile
#include<fstream>
#include<iostream>
#include<thread>
#include<string>
#include<cstdio>
void write(std::string filename, std::string message){
std::ofstream f;
f.open(filename, std::ofstream::out | std::ofstream::app);
for (auto i = 0; i < 10; i++) {
f << filename << " " << message << std::endl;
#include<fstream>
#include<vector>
#include<tuple>
#include<iostream>
#include<string>
#include<charconv>
#include<map>
#include<cmath>
#include<set>
#include<algorithm>
#include <string>
#include <iostream>
#include<utility>
#include<algorithm>
#include<fstream>
#include<thread>
#include<functional>
#include<array>
#include<vector>
#include<fstream>
#include<string>
#include<iostream>
#include<vector>
std::vector<std::string> split_string(std::string string_input, char delimeter) {
std::vector< std::string > split_strings;
std::string thing;
for (auto a: string_input){
import discord
from discord.ext import commands
import random
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
bot = commands.Bot(command_prefix='?', description=description)
@JVero
JVero / build.sh
Last active October 11, 2018 02:06
clang++ -c mat.cpp -o mat.o;
clang++ main.cpp mat.o;
import datetime
import re
import msvcrt
import time
import sys
def birthday(string):
regex = re.compile("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$")
a = regex.search(string)
import numpy as np
from matplotlib import pyplot as plt
def generate_generic_kernel(bandwidth, kernel_type):
def u(x): return x/bandwidth - 1 # u normalizes the range of the kernel supports between [-1, 1]
kernels = {
'epanechnikov': lambda x: 3/4 * (1 - u(x)**2),
'triangular': lambda x: 1 - np.abs(u(x)),
'knn': lambda x: 1/2
}
func TestPort(t *testing.T) {
s := a.CreateServer("9000")
defer s.Close()
go func() {
for {
var buf [512]byte
_, addr, _ := s.ReadFromUDP(buf[0:])
s.WriteToUDP([]byte{1, 3, 3, 4, 5, 6, 4, 65, 4, 6, 4, 6, 4, 6, 3, 5, 3, 5, 5}, addr)
}
}()
@JVero
JVero / client_test.go
Last active August 2, 2018 18:40
very basic UDP server and client with test. net.Dial creates different addresses even though I set the port to 9000
package client
import (
"fmt"
"testing"
a "../go_server"
)
func TestPort(t *testing.T) {