Skip to content

Instantly share code, notes, and snippets.

View ansrivas's full-sized avatar

Ankur Srivastava ansrivas

View GitHub Profile
@ansrivas
ansrivas / uci-guest-wifi.sh
Created July 14, 2023 12:20 — forked from tongpu/uci-guest-wifi.sh
uci script for OpenWRT guest WiFi configuration
#!/bin/sh
uci batch << EOF
add network switch_vlan
set network.@switch_vlan[-1].device='switch0'
set network.@switch_vlan[-1].ports='1t 5t'
set network.@switch_vlan[-1].vlan='2'
set network.guest='interface'
set network.guest.type='bridge'
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
docker run -d -p 27000-27015:27000-27015/udp -p 6003:6003/udp -p 7002:7002/udp cm2network/steamcmd
# login to container
@ansrivas
ansrivas / generate-ssh-key.sh
Created January 16, 2020 08:32 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@ansrivas
ansrivas / nginx.conf
Created July 21, 2019 15:36 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ansrivas
ansrivas / errors.grpc_conf
Created July 2, 2019 10:46 — forked from nginx-gists/errors.grpc_conf
Deploying NGINX Plus as an API Gateway, Part 3: Publishing gRPC Services
# Standard HTTP-to-gRPC status code mappings
# Ref: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md
#
error_page 400 = @grpc_internal;
error_page 401 = @grpc_unauthenticated;
error_page 403 = @grpc_permission_denied;
error_page 404 = @grpc_unimplemented;
error_page 429 = @grpc_unavailable;
error_page 502 = @grpc_unavailable;
error_page 503 = @grpc_unavailable;
@ansrivas
ansrivas / hmac-sha1.py
Created April 21, 2019 23:21 — forked from binaryatrocity/hmac-sha1.py
HMAC-SHA1 Python example
from sys import argv
from base64 import b64encode
from datetime import datetime
from Crypto.Hash import SHA, HMAC
def create_signature(secret_key, string):
""" Create the signed message from api_key and string_to_sign """
string_to_sign = string.encode('utf-8')
hmac = HMAC.new(secret_key, string_to_sign, SHA)
return b64encode(hmac.hexdigest())
@ansrivas
ansrivas / attributes.rb
Created April 20, 2019 07:48 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
### curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed