Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
// https://dotnetfiddle.net/42ancP
// https://stackoverflow.com/questions/52885600/c-sharp-parallel-foreach-does-not-wait-until-finished
using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
@sailfish009
sailfish009 / mantisbt_password.txt
Created October 1, 2018 06:09
mantisbt user password
root account
mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.21-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use bugtracker;
https://stackoverflow.com/questions/7437660/how-do-i-recreate-an-excel-formula-which-calls-trend-in-c#7437866
/// <summary>
/// Gets the value at a given X using the line of best fit (Least Square Method) to determine the equation
/// </summary>
/// <param name="points">Points to calculate the value from</param>
/// <param name="x">Function input</param>
/// <returns>Value at X in the given points</returns>
double get_max(int min, int max, ref double[] arr)
{
return arr.Skip(min).Take(max - min + 1).Max();
}
double get_min(int min, int max, ref double[] arr)
{
return arr.Skip(min).Take(max - min + 1).Min();
}
https://superuser.com/questions/603026/mysql-how-to-fix-access-denied-for-user-rootlocalhost
None of the above were helpful for me. I found I needed to clear the plugin method. In 5.6, I could do:
sudo mysql -u root
use mysql;
[mysql] update user set plugin='' where User='root';
[mysql] flush privileges;
In 5.7, I found I needed to:
@sailfish009
sailfish009 / vs_professional.txt
Created July 28, 2018 02:27
vs2017 offline installer for c++ and .net
vs_professional.exe --layout c:\vs2017 --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --includeOptional --lang en-US
private int match(double match_value, int min, int max, int match_type, ref double[] array)
{
switch (match_type)
{
case 1:
{
List<double> val_in_range = new List<double>();
for (int i = min; i < max+1; ++i)
{
if (array[i] <= match_value)
@sailfish009
sailfish009 / c#.txt
Last active September 20, 2018 06:40
https://stackoverflow.com/questions/17995706/how-to-get-the-index-of-an-item-in-a-list-in-a-single-step
http://www.cplusplus.com/reference/algorithm/max_element/
https://stackoverflow.com/questions/4412596/c-sharp-arrays-minimal-value-in-specific-range
max value of int/uint + 1 == -2xxxxxxx or / 0
foreach (DataRow row in dtout.Rows)
{
@sailfish009
sailfish009 / richhickey.md
Created April 18, 2018 03:25 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

https://blog.samaltman.com/productivity
Productivity
I think I am at least somewhat more productive than average, and people sometimes ask me for productivity tips. So I decided to just write them all down in one place.
Compound growth gets discussed as a financial concept, but it works in careers as well, and it is magic. A small productivity gain, compounded over 50 years, is worth a lot. So it’s worth figuring out how to optimize productivity. If you get 10% more done and 1% better every day compared to someone else, the compounded difference is massive.
WHAT YOU WORK ON