Skip to content

Instantly share code, notes, and snippets.

Avatar

Tesla Lau Tesla9527

  • Shanghai, China
View GitHub Profile
@Tesla9527
Tesla9527 / tserv
Created Nov 16, 2018 — forked from jiffyclub/tserv
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
View tserv
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,
@Tesla9527
Tesla9527 / hashdeep.py
Created May 9, 2017 — forked from techtonik/hashdeep.py
Python - hashdeep.py - recursive hash of directory tree files in hashdeep format
View hashdeep.py
"""
Build recursive hash of files in directory tree in hashdeep format.
Hashdeep format description:
http://md5deep.sourceforge.net/start-hashdeep.html
hashdeep.py differences from original hashdeep:
- if called without arguments, automatically starts to build
View Replace connectionString using PowerShell
$connectionString = "Data Source=shaappt0001;Initial Catalog=Bpm;Persist Security Info=true;User ID=sa;PWD=Passw0rd;Packet Size=4096;" providerName="System.Data.SqlClient"
$webConfigPath = "%teamcity.build.workingDir%\Bpm\web.config"
$xml = [xml](get-content $webConfigPath)
$root = $xml.get_DocumentElement();
$root.connectionStrings.add.connectionString = $connectionString
$xml.Save($webConfigPath)
View sql 拼接字段
SELECT a.GroupCD,a.GroupName,a.GroupParentCD,
( SELECT GroupName
FROM dbo.Bpm_OrganizationMiddle
WHERE GroupCD = a.GroupParentCD
) GroupParentCDName,a.is_delete
FROM dbo.Bpm_OrganizationMiddle AS a;
View Using business objects as model in mvc
-----------------------------
Below is code in Employee.cs in project BusinessLayer
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BusinessLayer
View Working with multiple tables in mvc
-----------------------------
Below is code in EmployeeController.cs
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplication2.Models;
View Generate hyperlinks using actionlink html helper
View Data access in mvc using entity framework
-----------------------------
Below is code in EmployeeContext.cs
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace WebApplication2.Models
View Models in an mvc application
-----------------------------
Below is code in Employee.cs
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebApplication2.Models
{