Skip to content

Instantly share code, notes, and snippets.

View elreydetoda's full-sized avatar

elreydetoda

View GitHub Profile
@elreydetoda
elreydetoda / WinKey.ps1
Last active May 15, 2021 15:16
Get the Product key from windows
# how to use this script
# iex (new-object system.net.webclient).DownloadString("https://git.io/JsnxS")
# if that fails, it is probably something with the tls level ( took from chocolatey install )
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
# then run the iex command again
# src: https://nedimmehic.org/2017/02/17/how-to-find-windows-product-key-allversions-of-windows/
function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Nedim Mehic
param ($targets = ".")
  • SC1000 $ is not used specially and should therefore be escaped.
  • SC1001 This \o will be a regular 'o' in this context.
  • SC1003 Want to escape a single quote? echo 'This is how it'\''s done'.
  • SC1004 This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
  • SC1007 Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
  • SC1008 This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
  • SC1009 The mentioned parser error was in ...
  • SC1010 Use semicolo
@elreydetoda
elreydetoda / Vagrantfile
Last active December 26, 2020 17:02
Algo vpn Vagrantfile. Simply vagrant up then ./algo, checkout the z-cmds section for easy consumption (z- is prepended so you see the vagrant files first).
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.provision "shell", inline: <<-SHELL
# installing and configure docker stuff
curl -fsSL 'https://get.docker.com' | bash
sudo usermod -aG docker vagrant
mapfile -t env_varz < <(env | grep -iE 'packet|tf_|vagrant_|circle|release' | cut -d '=' -f 1)
IFS=" " read -r -a env_vars_array <<< "$(printf ' -e %s' "${env_varz[@]}")"
docker container run --rm -it "${env_vars_array[@]}" -v "${PWD}/scripts":/scripts bash
@elreydetoda
elreydetoda / Pipfile
Created September 19, 2020 21:22
[BUG] files needed for packerlicious bug: https://github.com/elreydetoda/packerlicious/issues/1
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
# for python dev
pylint = "*"
bandit = "*"
black = "==20.8b1"
@elreydetoda
elreydetoda / ansible-semver.yml
Created August 30, 2020 10:11
an ansible playbook that does semantic version sorting, more here: https://github.com/diodonfrost/ansible-role-vagrant/pull/1
---
- hosts: localhost
tasks:
- name: Linux | Find all versions of Vagrant
uri:
url: https://releases.hashicorp.com/vagrant/index.json
return_content: yes
register: vagrant_index
# this was the original code from here: https://github.com/diodonfrost/ansible-role-vagrant/blob/master/tasks/setup-Linux.yml#L14
#!/usr/bin/env bash
set -${-//[s]/}eu${DEBUG+xv}o pipefail
season=(
'Spring'
'Summer'
'Fall'
'Autumn'
'Winter'
@elreydetoda
elreydetoda / FindOUpermissions.ps1
Last active July 23, 2020 18:30 — forked from neKuehn/FindOUpermissions.ps1
A different PowerShell script that finds permissions assigned to OUs. This one must be run from a windows system joined to the domain to be queried.
function Get-OUPermissions{
<#
.SYNOPSIS
FindOuPermissions is a Windows PowerShell script that finds all of the different OUs in a domain,
determins the permissions assigned to different users and groups, and reports back which are different
from their parent; including what those permissions are.
This script does require that the device be joined to the domain being queried and RSAT is installed.
@elreydetoda
elreydetoda / ubuntu-install.sh
Last active April 25, 2020 13:37
installing all things for ubuntu script
#!/usr/bin/env bash
set -exuo pipefail
##################################################
### Variables
## apt
apt_repos=(
'ppa:kgilmer/regolith-stable' # https://blog.elreydetoda.site/minimal-i3-gaps-install-ubuntu/
'ppa:linuxuprising/shutter' # awesome screenshotting software
@elreydetoda
elreydetoda / Set-WindowsUTCTime.ps1
Last active April 15, 2020 11:35
used to make windows recognize the bios clock as UTC, which is used by a lot of *nix distros, and will screw up your time if you dual boot.
# script came from: https://devblogs.microsoft.com/scripting/update-or-add-registry-key-value-with-powershell/
# values for script came from: https://weblogs.asp.net/dfindley/Set-hardware-clock-to-UTC-on-Windows-_2800_or-how-to-make-the-clock-work-on-a-Mac-Book-Pro_2900_
# Registry path for where the key should go
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
# name of registry key you are adding
$Name = "RealTimeIsUniversal"
# value of key
$value = "1"