Skip to content

Instantly share code, notes, and snippets.

@pcarrier
pcarrier / $profile .ps1
Last active April 2, 2021 19:30
Windows setup
function safe { Set-Variable WhatIfPreference $true -Scope Global };
function unsafe { Set-Variable WhatIfPreference $false -Scope Global -WhatIf:$false };
function isAdmin {
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator);
}
function shell { Start-Process powershell -WorkingDirectory $PWD -ArgumentList "-NoLogo" };
function admin { Start-Process powershell -ArgumentList "-NoLogo" -Verb RunAs };
@alces
alces / ansible_local_playbooks.md
Last active June 23, 2025 17:21
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@adisib
adisib / youtube_hd.user.js
Last active June 26, 2025 18:24
Make youtube videos in HD and automatically resize
// ==UserScript==
// @name Youtube HD
// @author adisib
// @namespace namespace_adisib
// @description Select a youtube resolution and resize the player.
// @version 2025.04.13
// @match https://*.youtube.com/*
// @noframes
// @grant GM.getValue
// @grant GM.setValue
@mrlesmithjr
mrlesmithjr / ansible-macos-homebrew-packages.yml
Last active January 21, 2025 16:34
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
@ageis
ageis / systemd_service_hardening.md
Last active June 27, 2025 13:40
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@maboloshi
maboloshi / Reg2Bat.vbs
Last active October 21, 2022 09:22
[Reg2Bat]一个将reg格式的注册表文件 转成bat文件的vbs脚本原作者:http://slore.blogbus.com/logs/52627038.html,修改作者:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=386057
'------------------------------------------------------------------------------
'名称:Reg2Bat_By Slore(生成同名bat文件,支持XP、WIN7、WIN7X64).vbs
'功能:REG文件转换为同名的BAT、CMD文件。
'原文http://slore.blogbus.com/logs/52627038.html
' REG命令功能有限,仅支持常用类型。
' (REG_SZ、REG_DWORD、REG_BINARY、
' REG_EXPAND_SZ、REG_MULTI_SZ)
'
' By Slore 【修改by 代码飞扬】
' 更新于:2017年2月16日
@EntropyWorks
EntropyWorks / add-ssh-keys.yml
Last active March 29, 2022 21:04
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
@mosquito
mosquito / README.md
Last active June 22, 2025 08:16
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@bdwyertech
bdwyertech / vmware_fusion_reset_networking.sh
Last active April 25, 2025 10:07
VMWare Fusion - Reset Networking
#!/bin/bash
# Reset VMware Fusion Networking
# Clear out the Configuration
sudo rm -f /Library/Preferences/VMware\ Fusion/networking*
sudo rm -f /Library/Preferences/VMware\ Fusion/*location*
sudo rm -rf /Library/Preferences/VMware\ Fusion/vmnet*
sudo rm -rf /var/db/vmware/vmnet-dhcpd-vmnet*
# Reconfigure Networking
@robdodson
robdodson / index.html
Last active October 4, 2023 18:57
Shady DOM example
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Hello from outside the Shadow DOM!</h2>