Skip to content

Instantly share code, notes, and snippets.

View smowtion's full-sized avatar

Smowtion smowtion

View GitHub Profile
@smowtion
smowtion / how_to_get_telegram_chat_id.md
Created June 18, 2024 06:10 — forked from nafiesl/how_to_get_telegram_chat_id.md
How to get Telegram Bot Chat ID

How to get Telegram Bot Chat ID

Create a Telegram Bot and get a Bot Token

  1. Open Telegram application then search for @BotFather
  2. Click Start
  3. Click Menu -> /newbot or type /newbot and hit Send
  4. Follow the instruction until we get message like so
    Done! Congratulations on your new bot. You will find it at t.me/new_bot.
    
@smowtion
smowtion / mac-vendor.txt
Created July 14, 2023 05:36 — forked from aallan/mac-vendor.txt
List of MAC addresses with vendors identities
000000 Officially Xerox
000001 SuperLAN-2U
000002 BBN (was internal usage only, no longer used)
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 powerpipes?
@smowtion
smowtion / proxmox-install.sh
Created June 11, 2023 13:54 — forked from willwm/proxmox-install.sh
Fresh Proxmox Server install script
#!/bin/bash
# TODO: Remove pve-enterprise, add pve-no-subscription repo to sources.list(*)
# Update packages, install essentials
apt update
apt install -y build-essential git zsh htop
# Update Proxmox Appliance Manager (https://forum.proxmox.com/threads/no-turnkey-fresh-install-5-1-35.38199/)
pveam update
@smowtion
smowtion / Bash Comparison Operators.sh
Created April 9, 2023 13:29
Bash Comparison Operators
# Bash Comparison Operators
### Integer Comparison
Operator Description Example
-eq Is Equal To [ 100 -eq 100 ]
-ne Is Not Equal To [ 100 -ne 200 ]
-gt Is Greater Than [ 200 -gt 100 ]
-ge Is Greater Than Or Equal To [ 100 -ge 100 ]
-lt Is Less Than [ 100 -lt 200 ]
-le Is Less Than Or Equal To [ 100 -le 100 ]
@smowtion
smowtion / build.sh
Created January 3, 2023 15:24 — forked from max-mapper/build.sh
create a tinycorelinux fs with custom .tcz packages
# create a tinycorelinux fs with custom .tcz packages
# prerequisites: apt-get install squashfs-tools, npm i nugget -g
# dl release + packages (add your packages here)
nugget http://tinycorelinux.net/6.x/x86/release/TinyCore-current.iso http://tinycorelinux.net/6.x/x86/tcz/{nodejs,fuse,openssl-1.0.1,python,pkg-config,make,gcc,cloog,isl,gmp,mpfr,binutils,mpc,gcc_base-dev,gcc_libs-dev,gcc_libs,glibc_base-dev,linux-3.16.2_api_headers}.tcz -c
# node (add your packages here)
unsquashfs -f nodejs.tcz
unsquashfs -f openssl-1.0.1.tcz
@smowtion
smowtion / demo.php
Created June 6, 2022 17:01 — forked from freekrai/demo.php
PHP session-based rate limiter for APIs
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
@smowtion
smowtion / base64_padding.md
Created March 7, 2022 16:14 — forked from perrygeo/base64_padding.md
Avoiding TypeError: Incorrect padding with Python's base64 encoding

Avoiding padding errors with Python's base64 encoding

>>> import base64
>>> data = '{"u": "test"}'
>>> code = base64.b64encode(data)
>>> code
'eyJ1IjogInRlc3QifQ=='
@smowtion
smowtion / chromedriver.sh
Created January 9, 2022 14:06 — forked from mikesmullin/chromedriver.sh
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@smowtion
smowtion / tunnelbroker-net.linux.etc-network-interfaces.sh
Last active September 8, 2021 10:11 — forked from pklaus/tunnelbroker-net.linux.etc-network-interfaces.sh
tunnelbroker.net : tunnel setup on Linux using "ip" from the iproute suite (iproute2)
#!/bin/bash
# IPv6 Tunnel setup of an tunnelbroker.net tunnel on Linux using the configuration file `/etc/network/interfaces`
# (needs the `ip` tool from the iproute suite, Ubuntu package: <http://packages.ubuntu.com/iproute>)
#
# Run like this:
# ./tunnelbroker-net.linux.etc-network-interfaces.sh
#
# 2011 by Philipp Klaus
# Published on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-tunnel-setup-on-ubuntu-11-04/>
@smowtion
smowtion / disable_gpu.py
Created August 21, 2021 04:06 — forked from AIAnytime/disable_gpu.py
How to disable GPU with TensorFlow?
try:
# Disable all GPUS
tf.config.set_visible_devices([], 'GPU')
visible_devices = tf.config.get_visible_devices()
for device in visible_devices:
assert device.device_type != 'GPU'
except:
# Invalid device or cannot modify virtual devices once initialized.
pass