This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -t nat -F | |
iptables -t mangle -F | |
iptables -F | |
iptables -X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import os | |
url = "https://grafana.rbx.com" | |
headers = { | |
"Authorization": "Bearer " + os.environ["GRAFANA_TOKEN"], | |
"Accept": "application/json", | |
"Content-Type": "application/json", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -uo pipefail | |
# set -x | |
PATH=$PWD/bin:$PATH | |
RUST_HOME=$HOME/docker-rust | |
SYSV=$(pidof /sbin/init >/dev/null && echo "yes" || echo "no") | |
SYSD=$(pidof systemd >/dev/null && echo "yes" || echo "no") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import re_path | |
from rest_framework.authtoken.views import ObtainAuthToken | |
from .serializers import AuthTokenSerializer | |
ObtainAuthToken.serializer_class = AuthTokenSerializer | |
obtain_auth_token = ObtainAuthToken.as_view() | |
urlpatterns = [ | |
re_path(r'^api-token-auth/$', obtain_auth_token) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import re_path | |
from rest_framework.authtoken.views import obtain_auth_token | |
urlpatterns = [ | |
re_path(r'^api-token-auth/$', obtain_auth_token) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.translation import ugettext_lazy as _ | |
from rest_framework import serializers | |
from rest_framework.compat import authenticate | |
class AuthTokenSerializer(serializers.Serializer): | |
email = serializers.CharField(label=_("Email")) | |
password = serializers.CharField( | |
label=_("Password"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function usage { | |
echo "view-log <status-regex> [--pull]" | |
exit 1 | |
} | |
[[ "$1" == "" ]] && usage || filter=$1 | |
[[ ! -d ~/.awslogs ]] && mkdir ~/.awslogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chext { | |
for f in *.$1; do | |
mv -- "$f" "${f%.$1}.$2"; | |
done; | |
} | |
# example changing all files *.jpeg to *.jpg: chext jpeg jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bats | |
if [ -z $TRASH ]; then | |
echo '$TRASH must be defined' | |
exit 1 | |
fi | |
trashdir=$TRASH | |
function finish { | |
trash > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
read -p "Where do you want to install bats? [~/.local] > " batspath | |
if [[ -z "$batspath" ]]; then | |
batspath="$HOME/.local" | |
fi | |
cd $HOME | |
git clone https://github.com/sstephenson/bats.git |
NewerOlder