Skip to content

Instantly share code, notes, and snippets.

@asimzeeshan
asimzeeshan / dockr
Created September 19, 2023 17:15 — forked from theodorosploumis/dockr
dockr - some useful docker shortcuts
#!/bin/bash
# add yourself to the docker group
# useradd -G docker USERNAME
# then you can enjoy this (for instance)
# dockr get logstash_container ip - to get the ip of the container
# or
# dockr stop last - to stop the last container you ran
# or
# dockr rmi none - to remove all <none> images
@asimzeeshan
asimzeeshan / ipv6_proxmox_online.net.md
Created July 19, 2023 00:50 — forked from zwindler/ipv6_proxmox_online.net.md
Configuring IPv6 block from Online.net On Proxmox Host and Guests

Configuring IPv6 block from Online.net On Proxmox Host and Guests

Following the documentation on online.net would get IPv6 to work only in a simple system installation but won't get IPv6 to work with virtualization environment (Exp. Proxmox) as It's missing some IPv6 forwards and proxies on sysctl.conf.

On Proxmox Host (Or Debian if single Debian Installation)

Enable IPv6 on the System:

  • Change Module Options to Enable IPv6:
@asimzeeshan
asimzeeshan / send2Telegram
Last active September 24, 2022 02:14 — forked from AkostDev/send2Telegram
PHP function for sending message to Telegram (using cURL)
function send2Telegram($id, $msg, $token = '', $silent = false) {
$data = array(
'chat_id' => $id,
'text' => $msg,
'parse_mode' => 'html',
'disable_web_page_preview' => true,
'disable_notification' => $silent
);
if($token != '') {
$ch = curl_init('https://api.telegram.org/bot'.$token.'/sendMessage');
@asimzeeshan
asimzeeshan / find_taint.sh
Created August 29, 2022 00:05
Kernel tainted, find modules responsible for it
# more help? https://docs.kernel.org/admin-guide/tainted-kernels.html
#!/bin/bash
cat /proc/modules |
while read module rest
do
if [[ $(od -A n /sys/module/$module/taint) != " 000012" ]] ; then
echo $module
fi
@asimzeeshan
asimzeeshan / sshupdate.py
Created August 16, 2022 11:07 — forked from rcoh/sshupdate.py
Automatically update your SSH config to allow ssh-ing into EC2 instances by their name. Works on Linux and Mac OS X.
import os
import subprocess
import boto.ec2
import itertools
AWS_KEY = os.getenv('AWS_ACCESS_KEY')
AWS_SECRET = os.getenv('AWS_SECRET_KEY')
# Tweak as necessary for your infrastructure
regions = ['us-east-1', 'us-west-1', 'eu-west-1']
@asimzeeshan
asimzeeshan / proxmox-proxy
Created July 24, 2022 23:06 — forked from basoro/proxmox-proxy
Running Proxmox behind a single IP address
I ran into the battle of running all of my VMs and the host node under a single public IP address. Luckily, the host is just pure Debian, and ships with iptables.
What needs to be done is essentially to run all the VMs on a private internal network. Outbound internet access is done via NAT. Inbound access is via port forwarding.
Network configuration
Here’s how it’s done:
Create a virtual interface that serves as the gateway for your VMs:
@asimzeeshan
asimzeeshan / project-create.sh
Created January 9, 2022 18:17 — forked from francoisromain/project-create.sh
A bash script to create a Git post-receive hook to deploy after a Git push
#!/bin/bash
# source: https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3
# and another script to delete the directories created by this script
# project-delete.sh: https://gist.github.com/francoisromain/e28069c18ebe8f3244f8e4bf2af6b2cb
# Call this file with `bash ./project-create.sh project-name`
# - project-name is mandatory
# This will creates 4 directories and a git `post-receive` hook.
@asimzeeshan
asimzeeshan / cloud_init_addkeys.sh
Last active January 2, 2022 21:23
Add my SSH keys (cloud-init)
#!/usr/bin/bash
# My Keys
SK_ME="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC7LltfwoFD2SwG2/gu1pMKaC4fvAsgAYpKIMgig8etvWb4BwDtx5j+QVAcm+PO0ryJPys2sGlXO5z6b4y+9NPTICcx+h617xxl+Ov7HKEIH5I3BUK8kBnrn6Xt4aPKcQbDyZAgh4d0vJ/ZA3SzIxC7OgVKcc9VNpP7YJlj44JyTBvBpLlRMSLrwGoULf6OtCsDLbfIGdAwyQrj0fC6p3sPG4li0SoLiUlt6MN2/VZQX/2VSOP75I2obRrXNKNtpsRyBa5H5IPlgRcYnJ5AGJyZ/ExN0pIhAa/Z/knwlrW5oWFFYN3slMwH11uti2MdFIpBjxRhlDhIFi37ljkJa8cqUDUXknjig95kaj1xLz+DiUwpJiHaP/VHXyMPFsLp9Q0jICGvocSvVvWKc2fGYghRShGbswK87xAN9kmT/+dUu5rt7q2QKJ6bn9h13ZVO4RVdZXXkzAbglJxEE26rWDlVKrtRchUQgWi6RNOdkK47lEE/qoyjuc88uCPjv1JGR2BlLfYc+8rt8NuwCgDrE30PrDlibZ6qweQCQ1ZrCO+FCRQMcQLcZDqG1nBPwmOcsiVIgH8ANLIOCuL+P6+TZwQIH2OX4VJPpxge30ambqpfClU9s5c1uOn0Njuoy8yRRyp6i3mB6GaVdSoq25wh4if0nAkWd3mBx/71kesRV9zs9Q== asim@techbytes.pk"
SK_BO="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCUOIEtlbuR2b5r4FYa/K0QLbel+WhE97DkBK2/Pejp97iLkHthxganpYCUCjnODDyJv2a1Xvwrxo3Bmj+HVBVs4+bw22nPNfhdcJQkjLU+BJNNRrGRzfKZfbacTyDtE7u6FqbglxkBZSHO+SnytQdB+wv6t51/eDUap9XoudecoSFP+IeRI59HR048uf++7M0G+5oOl4x
@asimzeeshan
asimzeeshan / get_latest_release.sh
Created November 30, 2020 13:20 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@asimzeeshan
asimzeeshan / test.php
Created June 9, 2020 13:52
for mohsin butt with love and kisses
<?php
function getURL($loc) {
switch ($loc) {
case "CU":
$host = $config->aulaIntegration->uniURL;
// wed don't need this
// $apiKey = $config->aulaIntegration->uniKey;
break;
case "CULC":