Skip to content

Instantly share code, notes, and snippets.

@ilyaigpetrov
ilyaigpetrov / FAILED: Доставка PinePhone Pro из Гонконга в Россию.md
Last active March 25, 2024 14:53
FAILED: Доставка PinePhone Pro из Гонконга в Россию
import time
class Sleepy(type):
def __getitem__(cls, value):
if isinstance(value, slice):
if value.step is None:
# start:stop
# minutes:seconds
@Beyarz
Beyarz / Wifi password.md
Created January 29, 2021 13:28
Retrieve saved wifi password

Macos

security find-generic-password -l "SSID" -D 'AirPort network password' -w

Linux

nmcli -s -g 802-11-wireless-security.psk connection show 'SSID'

Windows

@megahomyak
megahomyak / disable_or_enable_windows_defender.bat
Last active March 20, 2024 08:03
Disable or enable Windows Defender (DISABLE TAMPERING PROTECTION MANUALLY FIRST!!!)
@ECHO OFF
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
set /p what_to_do=enable or disable windows defender?:
if "%what_to_do%"=="disable" (
set state=1
) else (
if "%what_to_do%"=="enable" (
set state=0
Set objFS = CreateObject("Scripting.FileSystemObject")
outFile = "clip.txt"
oldClip = ""
Do
newClip = ClipBoard(Null)
If newClip <> oldClip Then
Set objFile = objFS.OpenTextFile(outFile, 8, True)
objFile.Write "############" & vbCrLf & ClipBoard(Null) & vbCrLf
objFile.Close
@fishchev
fishchev / index.html
Last active August 15, 2024 15:08
Minimal page structure/sample to trigger Telegram's IV template for https://teletype.in.
<!DOCTYPE html>
<head>
<title>$title</title>
<meta property="og:site_name" content="$site_name">
<meta property="og:description" content="$description">
<meta property="article:author" content="$author">
<!-- $image_url / link preview image is set using og:image property -->
<!-- <meta property="og:image" content="http://example.com/img.jpeg"> -->
<meta property="telegram:channel" content="@cor_bee">
@kvnxiao
kvnxiao / awesome-selfhosted-sorted-by-stars.md
Last active September 20, 2024 07:15
awesome-selfhosted-sorted-by-stars.md

Awesome-Selfhosted

Awesome

Selfhosting is the process of locally hosting and managing applications instead of renting from SaaS providers.

This is a list of Free Software network services and web applications which can be hosted locally. Non-Free software is listed on the Non-Free page.

See Contributing.

@owencm
owencm / blob-to-image.js
Created January 12, 2019 18:01
Convert a blob to an image with JavaScript (e.g. to render blob to canvas)
const blobToImage = (blob) => {
return new Promise(resolve => {
const url = URL.createObjectURL(blob)
let img = new Image()
img.onload = () => {
URL.revokeObjectURL(url)
resolve(img)
}
img.src = url
})
@sinewalker
sinewalker / send-email.md
Last active April 14, 2023 10:06
Sending email from Linux command line (postfix or netcat)
  • Send a blank test message with a subject to an email address:

    mail -s "Subject" user@example.com < /dev/null

    (you can substitute /dev/null with a file, or pipe, to populate the body. It must end with a period on a line by itself.)

  • Send a blank email with an attachment:

    mail -a somefile -s "Subject" user@example.com < /dev/null

@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active September 5, 2024 18:28
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable