Skip to content

Instantly share code, notes, and snippets.

@dxdxdt
dxdxdt / fuckyou-gmail.en.md
Last active September 7, 2023 17:44
What to do when Gmail marks all the mails from your server as spam

What to do when Gmail marks all the mails from your server as spam

If you're self-hosting your services and having trouble getting your emails through Gmail and infuriated by Google's non-existent support, you're not the only one. I'd like to share my experiences trying to get it sorted out.

I'm the author of the post above. You can tell how arrogant Google employees are from all the previous posts he made in the past.

@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@MineRobber9000
MineRobber9000 / 2fa
Created April 3, 2020 03:45
2-factor authentication terminal app in Python
#!/usr/bin/env python
import os, os.path, stat, sys, base64
# TOTP lib inlined
import time, hmac, base64, hashlib, struct
def pack_counter(t):
return struct.pack(">Q", t)
@kokumura
kokumura / lineinfile.sh
Created May 25, 2018 08:39
lineinfile in Shell Script
# Ansible 'lineinfile' like function in Shell Script.
# Works on both Bash and Zsh.
function lineinfile(){
if [[ $# != 3 ]];then
local THIS_FUNC_NAME="${funcstack[1]-}${FUNCNAME[0]-}"
echo "$THIS_FUNC_NAME - 3 arguments are expected. given $#. args=[$@]" >&2
echo "usage: $THIS_FUNC_NAME PATTERN LINE FILE" >&2
return 1
fi
@PaulW
PaulW / ovoapi.py
Created March 14, 2018 11:52
Python script to authenticate and pull data from ovo energy to track smart meter usage. Uses ovo's RESTful API interface. At present, the script will error on the initial authentication if no valid token already exists, as takes a short while for ovo to catch up it seems, so I need to add in a catch for this.
#!/usr/bin/env python
# This requires Python 2.7. This will not work with Python 3
USERNAME = 'Your@email.address'
PASSWORD = 'Your ovo Password'
from requests import Request, Session
import json
import time
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 9, 2024 20:00
Hyperlinks in Terminal Emulators
@obskyr
obskyr / stream_response.py
Last active April 2, 2024 09:53
How to stream a requests response as a file-like object.
# -*- coding: utf-8 -*-
import requests
from io import BytesIO, SEEK_SET, SEEK_END
class ResponseStream(object):
def __init__(self, request_iterator):
self._bytes = BytesIO()
self._iterator = request_iterator
@itay-grudev
itay-grudev / README.md
Last active March 19, 2021 19:53
BT WiFi Maintain Connectivity Script

BT WiFi Maintain Connectivity Script

Usage

btauth --user USER_OR_EMAIL --pass PASSWORD # To Authenticate with the BT WiFi
btmaintain --user USER_OR_EMAIL --pass PASSWORD # To maintain a connection and re-authenticate automatically
nohup btmaintain --user USER_OR_EMAIL --pass PASSWORD 2&gt;&amp;1 &gt;/dev/null &amp; # Same as above but ran in background
@dbehnke
dbehnke / luksloopback.sh
Created December 30, 2014 20:25
luks encryption with loopback file
#!/bin/bash
loopdevice=/dev/loop0
loopfile=crypt.loop
#megabytes
loopsize=256
#/dev/mapper/xxxxx when open
cryptmapper=myCrypt
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!