Skip to content

Instantly share code, notes, and snippets.

@revirth
revirth / Paralle.ForEach.DataTable.cs
Created October 31, 2014 06:02
using Paralle.ForEach to DataTable
[DllImport("kernel32.dll")]
static extern int GetCurrentProcessorNumber();
static void Main(string[] args)
{
DataTable dt = new DataTable();
dt.Columns.Add("n", typeof(int));
var numbers = Enumerable.Range(0, 1000);
Stopwatch sw = new Stopwatch();
sw.Start();
@revirth
revirth / Stopwatch
Created July 18, 2015 11:27
StopWatch,Timer
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();
// something doing
watch.Stop();
Response.Write(watch.Elapsed.ToString());
@revirth
revirth / Finding Component.py
Created January 24, 2016 14:40
When I study Vectors on KahnAcademy site, need to make a function to calculate to find a component from 2 vectors
# https://www.khanacademy.org/math/linear-algebra/vectors_and_spaces/vectors/e/adding-vectors-in-magnitude-and-direction-form
def findComponent(v,vR,w,wR):
l = v*math.cos(math.radians(vR))+w*math.cos(math.radians(wR))
r = v*math.sin(math.radians(vR))+w*math.sin(math.radians(wR))
return (l,r)
@revirth
revirth / C++_Unreal_Cours_1028.cpp
Last active October 29, 2022 18:40
C++_Unreal_Cours_1028
#include <iostream>
#include <string>
using namespace std;
void Exercise_While_Break()
{
string password;
while (true)