Skip to content

Instantly share code, notes, and snippets.

View nguyen190887's full-sized avatar

Tri Nguyen nguyen190887

View GitHub Profile
@nguyen190887
nguyen190887 / ProactiveMessageDemo.cs
Created November 27, 2018 03:27
BotFramework-ProactiveMessage
public class ProactiveMessageContext
{
public string ServiceUrl { get; set; }
public string BotId { get; set; }
public string ReplyToId { get; set; }
public string ChannelId { get; set; }

Run below command to assume a file is not changed (in case you changed it to use a local configuation - e.g. web.config)

git update-index --assume-unchanged <file>

Run below command to undo above assumption

git update-index --no-assume-unchanged <file>

Steps

  1. Create a bash file with the content below
"/c/Program Files/TortoiseGit/bin/TortoiseGitProc.exe" /command:$1
  • Save it to "<folder>\<file>" (e.g. D:\bash\g, where g is the command)
  1. Create a .profile file in C:\users\%username%\ folder with below content
export PATH="$PATH:/" #  is what mentioned step 1
public static string Build(string url, string token, string data)
{
string result = null;
var httpRequest = WebRequest.Create(url) as HttpWebRequest;
httpRequest.Method = "POST";
httpRequest.ContentType = "application/xml";
httpRequest.Headers["Authorization"] = $"Basic {token}";
httpRequest.Headers["Origin"] = httpRequest.RequestUri.GetLeftPart(UriPartial.Authority);
byte[] body = Encoding.ASCII.GetBytes(data);

Patern to sync file and excluding package or auto generated folders

*.* | node_modules\ packages\ bin\ obj\ .hg\ _node_modules\

  • Download key.pem file from Key Pairs section in EC2 console
  • Open PuTTYGen, load key.pem, then Save private key (ppk file)
  • Open PuTTY,
    • In Session category, enter user_name@public_dns_name (for Amazon AMI, user_name is ec2-user)
    • In Connection/SSH/Auth category, Browse ppk file
  • Click Open to start SSH

Create .vscode/launch.json file with content as below

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
 "program": "${workspaceFolder}/server.js",

Just list out some useful Linux commands/tips for a Windows developer like me :)

To create a user account from a shell prompt:

  • Open a shell prompt.
  • If you are not logged in as root, type the command su - and enter the root password.
  • Type useradd followed by a space and the username for the new account you are creating at the command line (for example, useradd jsmith). Press [Enter]. Often, usernames are variations on the user's name, such as jsmith for John Smith. User account names can be anything from the user's name, initials, or birthplace to something more creative.
  • Type passwd followed by a space and the username again (for example, passwd jsmith).
  • At the New password: prompt enter a password for the new user and press [Enter].
  • At the Retype new password: prompt, enter the same password to confirm your selection.
#Find attributes are set with @Url.Action in Razor files
[\w\d:-]+\s*=\s*"\(*@\(*Url\.Action\(
## Pattern to replace in Notepad++
Find: .+\s([\w\d:-]+)\s*=\s*"\(*@\(*Url\.Action\(.+
Replace with: $1