Skip to content

Instantly share code, notes, and snippets.

View mark05e's full-sized avatar

mark05E mark05e

View GitHub Profile
@ducas
ducas / Create-Administrator.ps1
Last active May 22, 2024 09:29
Create a local administrator account using PowerShell
$Username = "su"
$Password = "password"
$group = "Administrators"
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username }
if ($existing -eq $null) {
@version:3.2
# ===============================================================================================
# Configuration file for syslog-ng, customized for remote logging
# ===============================================================================================
# Options
# Note about $HOST / HOST
# Description: The name of the source host where the message originates from.
# If the message traverses several hosts and the chain_hostnames() option is on, the first host in the chain is used.
# If the keep_hostname() option is disabled (keep_hostname(no)), the value of the $HOST macro will be the DNS hostname of the host that sent the message to syslog-ng OSE (that is, the DNS hostname of the last hop). In this case the $HOST and $HOST_FROM macros will have the same value.
@jkjustjoshing
jkjustjoshing / $inject.user.js
Last active December 6, 2021 16:32
Angular $inject userscript.
// ==UserScript==
// @name AngularJS Injector
// @namespace http://joshkra.me/
// @version 0.1
// @description Binds $inject method to window
// @author jkjustjoshing
// @match *://*/*
// ==/UserScript==
// This userscript creates an $inject() method on the window object that can be used to
@dac09
dac09 / gist:932db6d5aba4d7020a47
Created April 13, 2015 19:54
Alfred Jira custom url
Alfred Custom Searches for Jira and Confluence
j - Jira issue number search - https://YOURCOMPANY.atlassian.net/issues/?jql=text%20~%20"{query}"
j+ - Jira issue full text search - https://YOURCOMPANY.atlassian.net/QuickSearch.jspa?searchString={query}
c+ - Confluence text search - https://YOURCOMPANY.atlassian.net/wiki/dosearchsite.action?queryString={query}
# Aliases
Set-Alias subl "C:\Program Files\Sublime Text 3\sublime_text.exe"
Set-Alias ie "C:\Program Files\Internet Explorer\iexplore.exe"
Set-Alias winscp "C:\Program Files (x86)\WinSCP\WinSCP.exe"
# Functions
function rdp { mstsc /control /v:$args }
function pssh { Enter-PSSession -Computername $args[0] -Credential etamgroep\dadmin8 }
@Khoulaiz
Khoulaiz / gist:41b387883a208d6e914b
Last active May 3, 2024 15:57
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@MyITGuy
MyITGuy / installed_dot_net_versions.ps1
Last active June 9, 2021 04:07
PowerShell: List installed .NET versions
Get-ChildItem -Path "$($env:WINDIR)\Microsoft.NET\Framework*" | % {Get-ChildItem -Path "$($_.PSPath)" | ? {$_.Name.StartsWith('v') -and $_.PSIsContainer -eq $true -and ((Test-Path -Path "$($_.FullName)\mscorlib.dll" -PathType Leaf) -eq $true)}} | Select @{Name="Version";Expression={$_.Name.TrimStart('v')}},@{Name="Bitness";Expression={if (!$_.Parent.ToString().TrimStart('Framework')) {[int]32} else {[int]$_.Parent.ToString().TrimStart('Framework')}}}
@aplocher
aplocher / AnyConnect.ahk
Last active September 6, 2023 07:18
AutoHotKey script for Cisco AnyConnect. Takes hostname, username, and password as external args. Great for creating multiple shortcuts if you have more than one AnyConnect VPN.
; Create a shortcut to this file in Windows for each AnyConnect VPN configuration you need
; Each shortcut can have a different host, user, and pass defined (3 command line args)
; Usage: AutoHotKey.exe AnyConnect.ahk hostname username password
#SingleInstance force
if 0 < 3 ; The left side of a non-expression if-statement is always the name of a variable.
{
MsgBox This script requires at least 3 incoming parameters but it only received %0%.
ExitApp
}
@akaleeroy
akaleeroy / Connect-to-Android-WebDAV-Server.md
Last active October 14, 2021 16:31
Access phone storage over WiFi with WebDAV Server for Android

Access phone storage over WiFi

Batch file to map your Android phone as network drive in Windows.

Preview of Phone.cmd usage

Requirements

@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set psexec="\\192.168.22.252\tmp\psexec.exe"
set nircmd="\\192.168.22.252\tmp\nircmd.exe"
set user=administrator
set pass=password
set savedir="\\192.168.22.252\tmp\test.png"