Skip to content

Instantly share code, notes, and snippets.

@Saanch
Saanch / Configure-WebSite.ps1
Last active December 15, 2017 00:21
Configure IIS Website via Powershell script
Param (
[Parameter(Mandatory=$true)]
[string]$webSiteName,
[Parameter(Mandatory=$true)]
[string]$webSitePhysicalPath,
[Parameter(Mandatory=$true)]
[string]$webSiteAppPool,
@Saanch
Saanch / nginx.docker-compose.yml
Created October 7, 2017 11:44
nginx reverse proxy letsencrypt docker-compose
version: '3'
services:
nginx:
image: nginx
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- 'nginx-config:/etc/nginx/conf.d'
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
import urllib
JIRA_URL = 'https://your-jira-url.tld/'
JIRA_ACCOUNT = ('jira-username', 'jira-password')
# the JIRA project ID (short)
JIRA_PROJECT = 'PRO'
@Saanch
Saanch / is_installed.sh
Created August 2, 2017 09:44 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script. Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@Saanch
Saanch / centos-docker.md
Last active April 13, 2017 10:08
Running Docker on centos

ssh to server

ssh root@ip

Add new user for managing docker

adduser username

Set password for the user

passwrd username

Add user to the sudo list(the following group is specific to the centos)

@Saanch
Saanch / npmupdate.md
Last active March 31, 2016 05:20
To Update npm package withoput editing package.json file

To update one dependency to its lastest version without having to manually open the package.json and change it, you can run

npm install {package-name}@* {save flags?} i.e.

npm install express@* --save For reference, npm-install

@Saanch
Saanch / gist:575928875f56d97da0e4b239ac508742
Created March 31, 2016 03:00
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
html, body {
height: 100%;
@Saanch
Saanch / nuget-restore.cmd
Created March 29, 2016 02:07 — forked from FeodorFitsner/nuget-restore.cmd
Batch file to reliably restore nuget packages with retries
@echo off
rem initiate the retry number
set errorCode=1
set retryNumber=0
set maxRetries=3
:RESTORE
nuget restore %*
rem problem?
@Saanch
Saanch / gitcommands.sh
Created March 12, 2016 02:24
Git Commands
//To view the content of the commits
git cat-file -p SHA -p
//add tag
git tag -a $tagname$ -m "$tag message$"
@Saanch
Saanch / editcsproj.cs
Created March 6, 2016 21:51
Edit csproj file via C#
private static void AddFilesToUnitTestProject(FileInfo[] files, string measureBaseDirPath, string measureDataDirSuffix)
{
var unitTestProjectPath = measureBaseDirPath + _unitTestProjectFile;
var unitTestProjectFile = XDocument.Load(unitTestProjectPath);
var itemGroup = unitTestProjectFile.Nodes()
.OfType<XElement>()
.DescendantNodes()
.OfType<XElement>().First(xy => xy.Name.LocalName == "ItemGroup");
foreach (var fileInfo in files)