Skip to content

Instantly share code, notes, and snippets.

find . -iname "*sha*" -exec bash -c 'mv "$0" "${0%\?*}"' {} \;
find . -name "node_modules" -prune -exec rm -rf '{}' +
@jareknowotka
jareknowotka / bash.generate.random.alphanumeric.string.sh
Last active October 7, 2020 10:58 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
openssl rand -hex 12
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
docker image ls | grep 144288054571 | awk '{ print $1 ":" $2 }' | xargs docker image rm
nc -zv host port
@jareknowotka
jareknowotka / net-http-debug.rb
Last active April 30, 2020 09:44 — forked from ahoward/net-http-debug.rb
a simple way to debug tons of libs that use ruby's net/http
BEGIN { require 'net/http'; Net::HTTP.module_eval do; alias_method '__initialize__', 'initialize'; def initialize(*args,&block);__initialize__(*args, &block);ensure;@debug_output = $stderr;end;end }

Keybase proof

I hereby claim:

  • I am jareknowotka on github.
  • I am jareknowotka (https://keybase.io/jareknowotka) on keybase.
  • I have a public key ASCdVgVqGlxFyz-HBVBp2BbDM9fV4CForvltRHAF8tmtRAo

To claim this, I am signing this object:

@jareknowotka
jareknowotka / cloudflare-blacklist.conf
Created June 14, 2016 09:26
action.d config for use together with script talking to cloudflare api.
[Definition]
actionban = cloudflare-firewall.sh ban <ip>
actionunban = cloudflare-firewall.sh unban <ip>
@jareknowotka
jareknowotka / couldflare-firewall.sh
Created June 14, 2016 09:22
Block IPs in Cloudflare using fail2ban rules.
#!/bin/bash
CF_USER=...
CF_TOKEN=...
CMD=$1
IP=$2
if [ $CMD = 'ban' ]; then
RESULT=$(curl -X POST "https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules" -H "X-Auth-Email: $CF_USER" -H "X-Auth-Key: $CF_TOKEN" -H "Content-Type: application/json" --data '{"mode":"block","configuration":{"target":"ip","value":"'${IP}'"},"notes":"Fail2Ban"}');