Skip to content

Instantly share code, notes, and snippets.

View pocheptsov's full-sized avatar

slava pocheptsov pocheptsov

View GitHub Profile
#!/bin/bash
terraform_upgrade() {
OS_NAME="darwin"
if [[ "$OSTYPE" == "linux"* ]]; then
OS_NAME="linux"
fi
TEMP_PATH="/tmp"
@pocheptsov
pocheptsov / dev-utils.sh
Last active November 3, 2016 21:01
Different DevOps commands
# find apache config file location
apache2 -V | grep 'HTTPD_ROOT\|SERVER_CONFIG_FILE'
# list top level global npm packages
npm -g ls --depth=0
# remove long path folder
rmdir node_modules /s /q
# windows: switch cmdline to run as Admin
@pocheptsov
pocheptsov / gulp-flatten-es5.js
Created April 26, 2016 21:29
flatten gulp structure
import path from 'path'
const flatten = function(destFolder) {
return function(file) {
file.path = file.base + path.basename(file.path)
return destFolder
}
}
//usage
@pocheptsov
pocheptsov / renamer.cs
Created October 8, 2015 14:14
Rename files in current folder based on modification date
using System;
using System.IO;
namespace rename
{
class Program
{
static void Main(string[] args)
{
var subfolderName = args?.Length > 0 ? args[0] : Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
[user]
email = [email]@gmail.com
name = slava pocheptsov
[push]
default = simple
[core]
symlinks = false
[color]
diff = auto
status = auto
@pocheptsov
pocheptsov / XUnitConsoleRunner.cs
Last active September 3, 2015 19:13
xUnit Console Runner
using System;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Xunit;
namespace TestsRunner
{
public class Program
@pocheptsov
pocheptsov / bzr-to-git.sh
Created August 12, 2015 19:38
Migrating from bazaar to git
# optionally create plugins directory
mkdir $HOME/.bazaar/plugins
# clone plugin repository
cd $HOME/.bazaar/plugins
bzr branch lp:bzr-fastimport fastimport
# clone dependency repo
bzr branch lp:python-fastimport python_fastimport
python setup.py install
@pocheptsov
pocheptsov / SoapExtensionRegistration.cs
Created July 30, 2015 20:22
Register SoapExtension in a code
public static void RegisterSoapExtension(Type type, int priority, PriorityGroup group)
{
if (!type.IsSubclassOf(typeof(SoapExtension)))
{
throw new ArgumentException("Type must be derived from SoapException.", nameof(type));
}
if (priority < 1)
{
throw new ArgumentOutOfRangeException(nameof(priority), priority, "Priority must be greater or equal to 1.");
@pocheptsov
pocheptsov / Program.cs
Created May 28, 2015 21:19
Face detection and uploading source file to Rekognition service from C# .NET Async
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorldRekognition
@pocheptsov
pocheptsov / run-sql-scripts.csx
Created September 5, 2013 19:25
Run sql scripts from directory, where script filename has a convention - [int number]_any_nam_after.sql ordered by [int number], execution break in case of any exception. ScriptCs format was used as a script language.
//#r "System.Data"
//uncomment previous lines to debug in VS
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Data;
using System.Data.SqlClient;
using System.Linq;