I hereby claim:
- I am SVilgelm on github.
- I am svilgelm (https://keybase.io/svilgelm) on keybase.
- I have a public key whose fingerprint is C08A 28D0 D765 525F E8B6 81B4 08D0 E2FF 7788 87E6
To claim this, I am signing this object:
| package spec | |
| import ( | |
| "encoding/json" | |
| "gopkg.in/yaml.v3" | |
| ) | |
| // SingleOrArray holds list or single value | |
| type SingleOrArray[T any] []T |
I hereby claim:
To claim this, I am signing this object:
| // https://www.joeshaw.org/dont-defer-close-on-writable-files/ | |
| func helloNotes() error { | |
| f, err := os.Create("/home/joeshaw/notes.txt") | |
| if err != nil { | |
| return err | |
| } | |
| defer f.Close() | |
| if err = io.WriteString(f, "hello world"); err != nil { | |
| return err |
exec_cmd('ping {ip}'.format(ip=ip))exec_cmd(format_cmd('ping {ip}', ip=ip))format_cmd('ping {ip}', ip="$(rm -rf /)")
$ ping '$(rm -rf /)'
ping: cannot resolve $(rm -rf /): Unknown host
| #!/bin/bash | |
| function get_ids { | |
| echo `$@ --fields=id | tail -n+4 | head -n-1 | awk '{ print $2 }'` | |
| } | |
| function get_body { | |
| echo `$@ | tail -n+4 | head -n-1` | |
| } |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| #/etc/rc.local | |
| ipset create black_ips hash:ip | |
| iptables -A INPUT -m set --match-set black_ips src -j DROP | |
| grep "Failed password for" /var/log/auth.log | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c | awk '$1 > 5 { print $2}' | xargs -I{} ipset add black_ips {} | |
| #!/usr/bin/env python2 | |
| from email import header | |
| from email.mime import audio | |
| from email.mime import application | |
| from email.mime import image | |
| from email.mime import multipart | |
| from email.mime import text | |
| import logging | |
| import mimetypes |
| Here is a quick tutorial to set up a basic PPTP VPN server on Ubuntu 12.04. | |
| Install Necessary Packages | |
| $ aptitude install ppp pptpd | |
| Configure DNS Servers to Use When Clients Connect to this PPTP Server | |
| $ nano /etc/ppp/pptpd-options | |
| Modify OR Add the following lines in end | |
| ms-dns 8.8.8.8 |
| import functools | |
| def dec(func=None): | |
| if func is None: | |
| return lambda f: dec(f) | |
| @functools.wraps(func) | |
| def wrapper(*args, **kwargs): | |
| print('wrapper') | |
| return func(*args, **kwargs) |