Skip to content

Instantly share code, notes, and snippets.

Add-Type -A System.IO.Compression.FileSystem
[IO.Compression.ZipFile]::CreateFromDirectory('C:\full\path\folder', 'c:\full\path\foler-output.zip')
@omarrodriguez15
omarrodriguez15 / GitCommitStats
Created June 20, 2019 22:16
Git the commit file stats for commits by author in specific date range.
git log --pretty=format:"%ad - %an: %s" --after="2017-01-22" --until="2017-02-18" --author="Rodriguez, Omar" --stat
@omarrodriguez15
omarrodriguez15 / ConEmusettings.xml
Last active October 7, 2019 13:43
My personal conemu settings on Windows 10
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2019-10-01 14:50:11" build="190331">
<value name="Language" type="string" data="en"/>
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{main-group}"/>
<value name="StartFarFolders" type="hex" data="00"/>
@omarrodriguez15
omarrodriguez15 / ZippingAround.cs
Created June 4, 2019 00:46
A class to easily compress a folder on Xamarin for Android
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Java.Util.Zip;
namespace foo
{
public class ZippingAround
@omarrodriguez15
omarrodriguez15 / AndroidTailFile.ps1
Created May 17, 2019 16:29
The tail follow command and android is not implemented so using powershell I am essentially achieving the same thing.
while ($true) {Start-Sleep -Seconds 1; iex 'adb -s 192.168.1.1 shell tail /sdcard/some-folder/some-log.log';}
[CmdletBinding()]
param()
# Create service user
$username = "SvcUsr"
if (!(Get-LocalUSer -Name $username -ErrorAction SilentlyContinue)) {
Write-Host "Enter password for $username :"
$usrPw = Read-Host -AsSecureString
New-LocalUser -Name $username -Password $usrPw -PasswordNeverExpires
} else {
private static void DoWork()
{
var nics = NetworkInterface.GetAllNetworkInterfaces();
NetworkInterface nicToUse = null;
foreach (var nic in nics)
{
Console.WriteLine($"NicName={nic.Name}");
if (nic.Name == "Local Area Connection 2") nicToUse = nic;
}
@omarrodriguez15
omarrodriguez15 / Verb-Noun.ps1
Created May 11, 2019 18:05
This is an example template for powershell scripts and functions.
<#
.SYNOPSIS
Name: Verb-Noun.ps1
The purpose of this script is to blah blah.
.DESCRIPTION
A slightly longer description of Why and How?
.PARAMETER ExampleParameter
The ExampleParameter is a required string parameter.
@omarrodriguez15
omarrodriguez15 / Get-MostChangedFilesInGit.ps1
Created May 3, 2019 17:24
Gets the top most changed files in a given repo with respect to the branch you are on.
git log --pretty=format: --name-only | Where-Object { ![string]::IsNullOrEmpty($_) -and !$_.EndsWith('.csproj') -and !$_.EndsWith('.config') } | Sort-Object | Group-Object | Sort-Object -Property Count -Descending | Select-Object -Property Count, Name -First 10
@omarrodriguez15
omarrodriguez15 / Invoke-AdbPortScanner.ps1
Last active July 16, 2019 13:19
Scans network for devices listenting on adb port 5555 but can be used to scan for other ports also
# One-liner in newer powershell
# Test-NetConnection 192.168.1.1 -Port 5555
[CmdletBinding()]
param(
[int]$Port = 5555,
[string]$Net = "10.0.1"
)