This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Reflection.Assembly]::LoadFrom( “C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll” ) | |
$mgr = New-Object Microsoft.Web.Administration.ServerManager | |
$mgr.ApplicationPools | % { $pm = $_.ChildElements[“processModel”]; Write-Host $_.Name $pm.Attributes[“userName”].Value$pm.Attributes[“password”].Value } | |
# Or, if you do not appreciate the brevity: | |
[System.Reflection.Assembly]::LoadFrom( “C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll” ) | |
$mgr = New-Object Microsoft.Web.Administration.ServerManager | |
$pools = $mgr.ApplicationPools | |
foreach ($pool in $pools) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def permutations(array): | |
if len(array) < 2: | |
yield array | |
else: | |
for shorter_permutation in permutations(array[1:]): | |
for i in range(len(array)): | |
yield shorter_permutation[:i] + array[0:1] + shorter_permutation[i:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<IEnumerable<T>> GeneratePermutations<T>(IEnumerable<T> source) | |
{ | |
var c = source.Count(); | |
if (c == 1) | |
yield return source; | |
else | |
for (int i = 0; i < c; i++) | |
foreach (var shorter_permuttaion in GeneratePermutations<T>(source.Take(i).Concat(source.Skip(i + 1)))) | |
yield return source.Skip(i).Take(1).Concat(shorter_permuttaion); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[reflection.assembly]::LoadWithPartialName("System.Web") | |
[System.Web.Security.Membership]::GeneratePassword(32,4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("SecretMessage")) | |
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("U2VjcmV0TWVzc2FnZQ==")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## | |
# Win10 Initial Setup Script | |
# Author: Disassembler <[email protected]> | |
# Version: 1.7, 2016-08-15 | |
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/ | |
# THIS IS A PERSONALIZED VERSION | |
# This script leaves more MS defaults on, including MS security features. | |
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGET_FILE_NUM=10000 | |
CURRENT_FILE_NUM=`ls -l | wc -l` | |
FILES_TO_GENERATE=$((TARGET_FILE_NUM - CURRENT_FILE_NUM)) | |
MAX_FILE_SIZE=8192 | |
FILE_NAME_PREFIX="test_" | |
if [[ $FILES_TO_GENERATE -lt 0 ]]; then | |
echo "We already have $CURRENT_FILE_NUM files, no need to generate more" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# override DHCP hostname assignment | |
sudo scutil --set HostName myhostname.domain.local | |
# tweak network | |
cat >> /etc/sysctl.conf <<EOF | |
# OSX default of 3 is not big enough | |
net.inet.tcp.win_scale_factor=8 | |
# increase OSX TCP autotuning maximums | |
net.inet.tcp.autorcvbufmax=33554432 | |
net.inet.tcp.autosndbufmax=33554432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to upload 501M SHA1 hashes into a SQL database | |
# | |
# Based on: | |
# https://blog.netnerds.net/2015/01/powershell-high-performance-techniques-for-importing-csv-to-sql-server/ | |
# https://gallery.technet.microsoft.com/scriptcenter/Import-Large-CSVs-into-SQL-216223d9 | |
# | |
# Database variables | |
$sqlserver = "YOUR_SERVER" | |
$database = "YOUR_DATABASE" | |
$table = "YOUR_TABLE" |
OlderNewer