This file contains hidden or 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
# Get all files in two depths with an m4v extension, pipe and rename. | |
Get-ChildItem */*.m4v | Rename-Item -NewName {$_.Name -Replace '\.m4v$', '.mp4'} | |
# Remove all mp4 / jpg files that has only integers in the name. | |
Get-ChildItem -File */* | Where {$_.Name -Match "^[0-9]+\.(jpg|mp4)"} | Remove-Item | |
# Count all files in two depths | |
(Get-ChildItem */* | Measure-Object).Count |
This file contains hidden or 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
# Defining useful variables and adding scripts into the PATH for later use | |
$desktop = [Environment]::GetFolderPath("Desktop") | |
$env:PATH += ";$desktop\scripts" | |
# SETUP | |
Clear-Host; wfetch | |
Set-Location $desktop | |
# The scripts folder must be created in your desktop for it to work, personally, it has the following scripts: | |
# wfetch: https://gist.github.com/ZSendokame/91c110ed2b4fc0bfebf57b1a4d5a4795 |
This file contains hidden or 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
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$path | |
) | |
$files = (Get-ChildItem $path) | Get-ChildItem | |
foreach($file in $files){ | |
$extension = $file.Extension | |
$newName = (Get-FileHash -LiteralPath $file.FullName -Algorithm MD5).Hash.toLower() |
This file contains hidden or 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
import fly | |
import arguing | |
args = arguing.Arguing() | |
selector = args.set('--selector', required=True) | |
work = args.set('--map') | |
html = fly.HTML(args.pipe()) | |
selected = html.css(selector) | |
for match in selected: |
This file contains hidden or 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
# WARNINGS AND WORKINGS: | |
# The script can be downloaded anywhere, but if there is no folder named as defined in $backupFolder, then it will create it. | |
# BEFORE running the script, add the folders to backup in the $folders array. | |
# To execute backup.ps1, calling it from a PowerShell session is enough (.\backup.ps1). | |
# Useful variables to modify and/or use. | |
$backupFolder = ".\backup" | |
$desktop = [Environment]::GetFolderPath("Desktop") | |
$folders = @() |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
2 | |
3 | |
5 | |
7 | |
11 | |
13 | |
17 | |
19 | |
23 | |
29 |
This file contains hidden or 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 relindex_value(iterable: list, column: list) -> list[dict]: | |
result = [] | |
aux = {} | |
for index, item in enumerate(iterable): | |
aux[column[index % len(column)]] = item | |
if (index % len(column)) == (len(column) - 1): | |
result.append(aux) |
This file contains hidden or 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
function space(){ | |
param($Directory) | |
$total = 0 | |
foreach($file in Get-ChildItem $Directory){ | |
$total += $file.length | |
} | |
return $total / 1Gb | |
} |
This file contains hidden or 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
{ | |
"MrYiang": { | |
"tf_projectile_arrow": { | |
"kills": 2, | |
"crits": 2 | |
}, | |
"spy_cicle": { | |
"kills": 2, | |
"crits": 2 | |
}, |
This file contains hidden or 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 flatten(structure: dict, head = [], flattened = {}) -> list: | |
for key, value in structure.items(): | |
if isinstance(value, dict): | |
head.append(key) | |
flatten(value, [*head, key], flattened) | |
else: | |
flattened['__'.join(head)] = value | |
return flattened |
NewerOlder