Skip to content

Instantly share code, notes, and snippets.

@johscheuer
johscheuer / get_pod_netns.sh
Last active November 28, 2024 17:34
This script get's the netns from a Kubernetes pod
#### WAY with crictl
#### TODO validate crictl with docker runtime !!
# Get all pods of a specific node
#kubectl get po --field-selector=spec.nodeName="fluffy-master" --all-namespaces
kubectl get --all-namespaces po --field-selector=spec.nodeName=="$(hostname)" -o json | jq -r '.items[] | select(.status.hostIP!=.status.podIP) | "\(.metadata.name) \(.metadata.namespace)"'
# Get the Pod ID of the Pod with crictl
POD_ID=$(sudo crictl pods --name=nginx-6f858d4d45-vnszm --namespace=default -q --no-trunc)
@bitsurgeon
bitsurgeon / youtube.md
Last active November 28, 2024 17:34
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
@MuhammadSaim
MuhammadSaim / rarreg.key
Last active November 28, 2024 17:31
Step 1: Create a file called rarreg.key Step 2: Paste into the file the raw content of this gist Step 3: Go to Winrar install directory (by default => c:\ProgramFiles\WinRAR\ ) Step 4: Paste the rarreg.key into WinRAR directory Step 5: Enjoy
RAR registration data
WinRAR
Unlimited Company License
UID=4b914fb772c8376bf571
6412212250f5711ad072cf351cfa39e2851192daf8a362681bbb1d
cd48da1d14d995f0bbf960fce6cb5ffde62890079861be57638717
7131ced835ed65cc743d9777f2ea71a8e32c7e593cf66794343565
b41bcf56929486b8bcdac33d50ecf773996052598f1f556defffbd
982fbe71e93df6b6346c37a3890f3c7edc65d7f5455470d13d1190
6e6fb824bcf25f155547b5fc41901ad58c0992f570be1cf5608ba9
@masudcsesust04
masudcsesust04 / change-apache-default-document-root-directory.md
Created July 28, 2017 05:57
4 steps to change your apache default document root directory

Step - 1: Create a directory

$ mkdir /home/masud/www/

Step - 2: Open apache2 configuration file

$ sudo nano /etc/apache2/apache2.conf 
@mattmc3
mattmc3 / optparsing_demo.zsh
Last active November 28, 2024 17:28
Zsh option parsing example
# Manual opt parsing example
#
# Features:
# - supports short and long flags (ie: -v|--verbose)
# - supports short and long key/value options (ie: -f <file> | --filename <file>)
# - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>)
# - does NOT support short option chaining (ie: -vh)
# - everything after -- is positional even if it looks like an option (ie: -f)
# - once we hit an arg that isn't an option flag, everything after that is considered positional
function optparsing_demo() {
@felipe-gustavo
felipe-gustavo / ArgparseDoc.md
Last active November 28, 2024 17:28
Parse args and options for Bash and Zsh

Argsparser Bash and Zsh Script

This script provides a robust and flexible way to parse command-line arguments in Bash or Zsh. It supports various features such as required options, array options, and next argument assignable options. The script is designed following best practices for modularity and maintainability.

Requirements

ZSH or BASH shells

GitHub Search Syntax for Finding API Keys/Secrets/Tokens

As a security professional, it is important to conduct a thorough reconnaissance. With the increasing use of APIs nowadays, it has become paramount to keep access tokens and other API-related secrets secure in order to prevent leaks. However, despite technological advances, human error remains a factor, and many developers still unknowingly hardcode their API secrets into source code and commit them to public repositories. GitHub, being a widely popular platform for public code repositories, may inadvertently host such leaked secrets. To help identify these vulnerabilities, I have created a comprehensive search list using powerful search syntax that enables the search of thousands of leaked keys and secrets in a single search.

Search Syntax:

(path:*.{File_extension1} OR path:*.{File_extension-N}) AND ({Keyname1} OR {Keyname-N}) AND (({Signature/pattern1} OR {Signature/pattern-N}) AND ({PlatformTag1} OR {PlatformTag-N}))

Examples:

**1.

@benvp
benvp / _paddle_script.html.eex
Last active November 28, 2024 17:21
Integrate Elixir/Phoenix with paddle.com -> See https://twitter.com/benvp_/status/1617624545791205379
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<%= if vendor_id = Application.get_env(:my_app, :paddle)[:vendor_id] do %>
<%= if Application.get_env(:my_app, :paddle)[:sandbox] do %>
<script type="text/javascript">
Paddle.Environment.set("sandbox");
Paddle.Setup({ vendor: <%= vendor_id %> });
</script>
<% else %>
<script type="text/javascript">
@nxrighthere
nxrighthere / Unreal-AgX-Tonemapper.usf
Last active November 28, 2024 17:20
AgX tonemapping for Unreal Engine 5
// See image comparison https://imgur.com/a/9L2P7GJ
// Read details https://iolite-engine.com/blog_posts/minimal_agx_implementation
// Usage:
// 1. Open "Project Settings" and change "Working Color Space" to "sRGB / Rec709"
// 2. Open `Engine\Shaders\Private\PostProcessTonemap.usf` file
// 3. Find `half3 OutDeviceColor = ColorLookupTable(FinalLinearColor);` line
// 4. Replace it with `half3 OutDeviceColor = ApplyAgX(FinalLinearColor);` line
// 5. Find `half3 ColorLookupTable( half3 LinearColor )` function
// 6. After the scope of the function, add the code below and run `RecompileShaders Changed` from console
@dotku
dotku / array_map.php
Created May 22, 2016 09:30
Use array_map to prevent `Array to string conversion` notice in array_diff
<?php
$arr1 = array(
'level1' => array(
'level2' => array(
'level3' => 'hello'
)
)
);
$arr2 = array('level3'=>'world');
$needle1 = array('level3'=>'hello');