Skip to content

Instantly share code, notes, and snippets.

#fill $ip, $user, $pass with right values
$ip = '192.168.1.1'
$user = 'user'
$pass = 'pass'
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace SummaryTool
{
public static class SummaryTool
@ahmadalli
ahmadalli / load.cs
Last active January 27, 2017 22:02
Dynamically load Entity Configurations in EF CodeFirst
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
var typesToRegister = Assembly.GetAssembly(typeof(Context)).GetTypes()
.Where(type => type.Namespace != null)
.Where(type => type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(EntityTypeConfiguration<>)).ToList();
foreach (var type in typesToRegister)
{
dynamic configurationInstance = Activator.CreateInstance(type);
modelBuilder.Configurations.Add(configurationInstance);
@ahmadalli
ahmadalli / BatchInstallLatestFaWordpess.ps1
Last active January 28, 2017 11:14
Installs latest version of Persian Translation of WordPress
$locations = @(
"location1",
"location2",
"location3")
#download
$salt = Get-Date
$salt = [math]::abs($salt.GetHashCode())
$url = "https://downloads.wordpress.org/release/fa_IR/latest.zip"
$zipFilePath = "$PSScriptRoot\wordpress-$salt.zip"
Import-Module BitsTransfer

Keybase proof

I hereby claim:

  • I am ahmadalli on github.
  • I am ahmadalli (https://keybase.io/ahmadalli) on keybase.
  • I have a public key whose fingerprint is 16EE A3FE 6D21 507A 12B1 DAC5 DA22 1805 3832 A5AC

To claim this, I am signing this object:

@ahmadalli
ahmadalli / GL503.ahk
Last active June 28, 2018 09:53
AutoHotKey scripts used for making my day to day life easier
; Adding CapsLock + Arrow Keys as `Home`, `End`, `Page Up`, and `Page Down` shortcuts.
; It's useful in Asus GL503 Keyboard which you can't use numpad and these keys (except for `Home`) simultaneously
CapsLock & Left::Home
CapsLock & Right::End
CapsLock & Up::PgUp
CapsLock & Down::PgDn
@ahmadalli
ahmadalli / all.css
Last active June 21, 2019 10:24
Wordpress Neve Persian Improvement.css
@import url('https://cdn.rawgit.com/rastikerdar/vazir-font/v20.1.0/dist/font-face.css');
@import url('https://cdn.rawgit.com/rastikerdar/shabnam-font/v4.0.0/dist/font-face.css');
h1, h2, h3, h4, h5, h6, .widget .widget-title, .site-description, .site-title, .entry-title, .entry-title a, .comments-title, .nav-menu a, widget-title {
font-family: Shabnam, "Source Sans Pro", Helvetica, sans-serif;
}
*, .entry-content {
font-family: Vazir;
@ahmadalli
ahmadalli / rtl.css
Last active June 22, 2019 07:06
RTL Jira with UserStyles
/* import this as mozilla format */
@-moz-document domain("<your jira domain>") {
.ghx-summary, .user-content-block, .action-body {
direction: rtl;
}
}
@ahmadalli
ahmadalli / youtrack-notify-slack.js
Created July 21, 2019 08:35 — forked from rushimusmaximus/youtrack-notify-slack.js
YouTrack JavaScript Workflow example: Post to Slack on specific issue state changes
var entities = require('v1/entities');
var http = require('v1/http');
exports.rule = entities.Issue.onChange({
title: 'Notify-slack',
action: function(ctx) {
var issue = ctx.issue;
if (issue.becomesReported || issue.becomesResolved || issue.becomesUnresolved) {
@ahmadalli
ahmadalli / gist:386da39e4c5db3f8999e170d1b50783f
Last active March 13, 2020 01:51 — forked from JayBazuzi/gist:9e0de544cdfe0c7a4358
How to reformat all C# files in a solution, in Visual Studio
# How to reformat all C# files in a solution, in Visual Studio 2012.
#
# Open Tools->Library Package Manager->Package Manager Console, and run the
# command below. At the end, all documents will be open in the IDE. (Low-RAM
# machines will have problems with large solutions.) Changed files will be
# modified in the IDE, and not saved to disk. You can SaveAll, then Close All
# if you're ready.
#
# VS2012 removed the VB-like macro language that existed in previous version of
# Visual Studio. However, the underlying DTE interface is still there, and you