Skip to content

Instantly share code, notes, and snippets.

View MarioBinder's full-sized avatar
:octocat:
.

Mario Binder MarioBinder

:octocat:
.
View GitHub Profile
@MarioBinder
MarioBinder / grantaccess.cs
Created August 18, 2020 13:26
grant access to database from entity framework
var sql = "USE <DBNAME>;" +
"create user [domain\\user] from login [domain\\user];" +
"ALTER ROLE db_datareader ADD MEMBER [domain\\user] ;";
try
{
using (var ctx = new MyContext())
{
Info($"Start Grant Acess to xx: {DateTime.Now}");
ctx.Database.ExecuteSqlCommand(sql);
@MarioBinder
MarioBinder / killl.sql
Last active August 18, 2020 13:24
kill database process by dbname
DECLARE @SQL varchar(max)
SELECT @SQL = COALESCE(@SQL,'') + 'kill ' + Convert(varchar, SPId) + ';'
FROM MASTER..SysProcesses
WHERE DBId = DB_ID(<DBNAME>) AND SPId <> @@SPId
--SELECT @SQL
--EXEC(@SQL)
@MarioBinder
MarioBinder / gist:2ba1bd2a0160091c98aa3082289ecbda
Created July 20, 2020 06:36
npm install - 500 Internal Server Error
1. Try to set npm registry using : npm config set registry https://registry.npmjs.org/
2. Check result of curl https://registry.npmjs.org/
3. Clear the cache: npm cache clean --force
4. Try to run npm install
via: https://stackoverflow.com/a/52134366/119109
@MarioBinder
MarioBinder / Bonobo Email Credentials.web.config
Created November 19, 2019 13:11
Configure the web.config for with Email Credentials for Bonobo Git Server (Forgot Password)
<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="[email protected]">
<network host="hostIP" port="25" userName="username" password="password" enableSsl="false" />
</smtp>
</mailSettings>
</system.net>
# via https://gist.github.com/shanselman/9a5f73071e41b46dfcf9585ed5e14085?WT.mc_id=-blog-scottha
Import-Module BitsTransfer
$path = $env:USERPROFILE + "\Downloads\"
$feedContent = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$cnt = 20
$feedContent.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $url.Segments[-1]
$cnt = $cnt - 1
@MarioBinder
MarioBinder / monitor.chrome.ps1
Created October 10, 2019 18:06
script for monitoring chrome
$target = "chrome"
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
while ($true)
{
while (!($process))
{
$process = Get-Process | Where-Object {$_.ProcessName -eq $target}
start-sleep -s 5
}
@MarioBinder
MarioBinder / profile.ps1
Last active March 26, 2021 10:44
some cool powershell commands to make the work easier
####################################################################################
# get the list of own aliases
# save under C:\Windows\System32\WindowsPowerShell\v1.0
function listMyAliases(){
echo "###############################################################################################"
echo " outlook #start Outlook"
echo " g <searchterm> #lmgtfy :)"
echo " so #search at stackoverflow with optional tags (blank separated)"
echo " n #download and init nuget"
echo " gitignore #get and save the gitignore file from API"
@MarioBinder
MarioBinder / digitaleocean.md
Created October 10, 2019 17:48
some comands for work with digitaleocean droplet
@MarioBinder
MarioBinder / Windows Service - Job Deploy #teamcity
Created September 16, 2019 05:40
Windows Service / Job Deploy #teamcity
$server = "%INT_Jobserver_Name%"
$username = "%INT_Jobserver_Username%"
$password = "%INT_Jobserver_Password%" | ConvertTo-SecureString -AsPlainText -Force
$creds = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$session = New-PSSession -ComputerName $server -Credential $creds
Enter-PSSession $session
Invoke-Command {Stop-Service "Softcrafts.Service.Name"} -Session $session
@MarioBinder
MarioBinder / Webdeploy Script #teamcity.md
Created September 16, 2019 05:36
Webdeploy Script #teamcity

Webdeploy (MSBuild)

/p:Configuration=%BuildConfiguration% //INT
/p:LastUsedBuildConfiguration=%BuildConfiguration% //INT
/p:PublishProfile=%DeployConfig% //Properties/PublishProfiles
/p:DeployIisAppPath=%WebDeployIisAppPath% //path to iis website
/p:UserName=%WebDeployUser%
/p:Password=%WebDeployPwd%
/p:AspnetMergePath=%AspnetMergePath% //"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"