Skip to content

Instantly share code, notes, and snippets.

View famousgarkin's full-sized avatar

Ján Dzurek famousgarkin

View GitHub Profile
@famousgarkin
famousgarkin / powershell-proxy-set-clear.ps1
Last active March 31, 2024 13:55
PowerShell Set-Proxy, Clear-proxy
# NOTE: registry keys for IE 8, may vary for other versions
$regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
function Clear-Proxy
{
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 0
Set-ItemProperty -Path $regPath -Name ProxyServer -Value ''
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value ''
[Environment]::SetEnvironmentVariable('http_proxy', $null, 'User')
@famousgarkin
famousgarkin / fluentd-out-exec-filter.conf
Last active July 1, 2023 10:15
Fluentd out exec filter
<source>
type http
port 8888
bind 127.0.0.1
</source>
<match test.**>
type copy
<store>
@famousgarkin
famousgarkin / fix.sh
Created March 18, 2017 18:10
ffmpeg fix "Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it."
ffmpeg -i "in.avi" -bsf:v mpeg4_unpack_bframes -vcodec copy "out.avi"
<!doctype html>
<html>
<body>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
function onYouTubeIframeAPIReady() {
console.log('API ready')
var player = new YT.Player('ytplayer', {
events: {
onReady: function() {
# https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/filter/core.py
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/kms.html
import boto3
import base64
kms = boto3.client('kms', region_name='eu-central-1')
def aws_kms_decrypt(ciphertext):
'''
set -ex
# https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/
# create
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
kubectl describe deployment nginx-deployment
kubectl get pods -l app=nginx
sleep 20s
@famousgarkin
famousgarkin / aws-orphaned-ami-snapshots-cleanup.sh
Last active August 27, 2018 05:44
AWS orphaned AMI snapshots cleanup
#!/usr/bin/env sh
# https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-snapshots.html
snapshots=$( \
aws ec2 describe-snapshots \
--region eu-central-1 \
--owner-id $OWNER_ID \
--filters 'Name=description,Values="Created by CreateImage*",Name=status,Values=completed'
)
@famousgarkin
famousgarkin / docker-check-if-inside-container.sh
Last active July 20, 2018 12:46
check if inside Docker container
grep -q docker /proc/1/cgroup
import os
def test_user_input(monkeypatch):
inputs = [10, 'y']
input_generator = (i for i in inputs)
monkeypatch.setattr('__builtin__.raw_input', lambda prompt: next(input_generator))
assert raw_input('how many?') == 10
assert raw_input('you sure?') == 'y'