Skip to content

Instantly share code, notes, and snippets.

@citruz
citruz / QEMU_ON_M1.md
Last active March 19, 2025 12:05
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@alex3165
alex3165 / aws-lambda-authorizer-google.js
Created July 10, 2019 17:25
An AWS lambda authorizer that work with google access token
const axios = require("axios");
exports.handler = async event => {
const token = event.authorizationToken;
console.log(`Received token`, token);
let googleAuthRes;
try {
googleAuthRes = await axios.get(
`https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=${token}`
@Carm01
Carm01 / Annoyances_Tweaks.cmd
Last active February 12, 2025 16:57
bat file commands to apply to a machine designed to replace the sysprep Aufit Mode / Copy Profile methodology. This provides a consistant and efficient way to apply user settings without manually doing it for all users. You can pick and choose which settings you want and do not want
:: https://stealthpuppy.com/customize-the-windows-default-profile/#.XEfajs17mUm
:: https://helgeklein.com/blog/2011/12/customizing-the-default-profile/
:: https://www.reddit.com/r/PowerShell/comments/8rupxv/unloading_registry_hive_with_a_script/
:: https://blogs.technet.microsoft.com/deploymentguys/2009/10/29/configuring-default-user-settings-full-update-for-windows-7-and-windows-server-2008-r2/
:: remove the double colon to activate the code if it is commented out
:: disable Cortana
:: https://www.addictivetips.com/windows-tips/disable-web-search-windows-10-april-update/
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /d 0 /t REG_DWORD /f
:: 5/9/2019
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /d 1 /t REG_DWORD /f
@mccabe615
mccabe615 / phpdangerousfuncs.md
Last active April 24, 2025 06:09
Dangerous PHP Functions

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
@Nihhaar
Nihhaar / audit2allow-sepolicy-android
Created August 22, 2017 20:50
Addressing selinux denials using audit2allow for android using logcat
# Goto android source code root and then execute following commands
# Keep the logcat.log in the root
export ANDROID_BUILD_TOP=$(pwd)
./external/selinux/prebuilts/bin/audit2allow -p out/target/product/{devicename}/root/sepolicy < logcat.log
# Copy the generated rules in respective files in the device tree
@jprichardson
jprichardson / configure-winrm.ps1
Created July 17, 2017 21:49 — forked from sneal/configure-winrm.ps1
Configure WinRM for Vagrant
netsh advfirewall firewall set rule group="remote administration" new enable=yes
netsh advfirewall firewall add rule name="Open Port 5985" dir=in action=allow protocol=TCP localport=5985
winrm quickconfig -q
winrm quickconfig -transport:http
winrm set winrm/config '@{MaxTimeoutms="7200000"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
winrm set winrm/config/winrs '@{MaxProcessesPerShell="0"}'
winrm set winrm/config/winrs '@{MaxShellsPerUser="0"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
@ljjjustin
ljjjustin / socat-tcp-to-unix-socket.sh
Last active April 1, 2025 15:17
socat-unix-socket-to-tcp.sh
#!/bin/bash
if [ $# -ne 3 ]; then
echo "usage: $0 <unix socket file> <host> <listen port>"
exit
fi
SOCK=$1
HOST=$2
PORT=$3
@sameerkumar18
sameerkumar18 / example_flask_googlecaptcha.py
Created May 20, 2017 07:04
A Simple Python Flask Example for Google Recaptcha (implemented on http://ipusearch.herokuapp.com)
RECAPTCHA_PUBLIC_KEY = '<public key>'
RECAPTCHA_PRIVATE_KEY = '<private key>'
def checkRecaptcha(response, secretkey):
url = 'https://www.google.com/recaptcha/api/siteverify?'
url = url + 'secret=' + str(secretkey)
url = url + '&response=' +str(response)
@cschiewek
cschiewek / x11_docker_mac.md
Last active March 25, 2025 13:23
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@keithweaver
keithweaver / get-file.py
Last active October 8, 2021 11:56
Get File Content with Python
# Example of getting file content
def getFileContent(pathAndFileName):
with open(pathAndFileName, 'r') as theFile:
# Return a list of lines (strings)
# data = theFile.read().split('\n')
# Return as string without line breaks
# data = theFile.read().replace('\n', '')