Skip to content

Instantly share code, notes, and snippets.

View reyou's full-sized avatar
🎯
Focusing

reyou

🎯
Focusing
View GitHub Profile
@reyou
reyou / publickey-git-error.markdown
Created September 7, 2018 18:45 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
@reyou
reyou / MockHttpClient.cs
Created August 23, 2018 18:14 — forked from GeorgDangl/MockHttpClient.cs
Mock an Asp.Net Core HttpClient with a custom HttpMessageHandler using Moq
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using Moq.Protected;
namespace Tests
{
public class MockHttpClient
@reyou
reyou / gist:a0b77761ac3bfd0c2df41fc909c4b62a
Created June 24, 2018 18:10
GET logstash-*/_mapping V2
{
"logstash-2015.05.18": {
"mappings": {
"log": {
"properties": {
"@message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
{
"logstash-2015.05.18": {
"mappings": {
"log": {
"properties": {
"@message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
var express = require("express");
var app = express();
var path = require("path");
app.get('/',function(req,res){
res.sendFile(path.join(__dirname+'/index.html'));
//__dirname : It will resolve to your project folder.
});
package TheAlgorithmDesignManual.AaaIntroduction;
public class insertion_sort_class {
public void insertion_sort(int[] s, int n) {
// counters
int i, j;
for (i = 1; i < n; i++) {
j = i;
while ((j > 0) && (s[j] < s[j - 1])) {
// https://stackoverflow.com/questions/7537791/understanding-recursion-to-generate-permutations/50382627#50382627
let str = "ABC";
permute(str, 0, str.length - 1, 0);
function permute(str, left, right, depth) {
if (left === right) {
console.log("PRINT:", str + "\n");
} else {
for (let i = left; i <= right; i++) {
// https://www.youtube.com/watch?v=5cPbNCrdotA
// we are trying to find next higher value
struct Node
{
int data;
struct Node *left;
struct Node *right;
}
// function to find In order successor in a BST
/** Algorithm: given a collection (matrix) of
pixels you must find the size of the largest shape.
Shapes were defined as pixels touching each other orthogonality. */
var input = [
[1, 1, 1, 1, 0],
[1, 1, 0, 1, 0],
[1, 1, 0, 0, 0],
[0, 0, 0, 0, 0]
];
var input2 = [
struct BstNode
{
int data;
BstNode *left;
BstNode *right;
};
int FindMin(BstNode *root)
{
if (root == NULL)