Skip to content

Instantly share code, notes, and snippets.

@ehrenfeu
ehrenfeu / html_mail.py
Last active April 24, 2024 22:24
Use Python to send HTML emails with expand/collapse boxes working in TB and Android
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_html_mail(subject, body, to_addr, from_addr):
"""Send an HTML email using the given subject, body, etc."""
# Create message container - the correct MIME type is multipart/alternative here!
message = MIMEMultipart('alternative')
message['subject'] = subject
@limingjie
limingjie / 256 colors.md
Last active April 24, 2024 22:15
256 colors in putty, tmux/screen and vim

#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.

  • putty

    Set Connection -> Data -> Terminal-type string to xterm-256color

  • tmux

Add this line to ~/.tmux.conf

#include <pthread.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@iati-bot
iati-bot / errors
Last active November 9, 2019 14:56 — forked from Bjwebb/errors
4 amnesty amnesty-1 http://50jaar.amnesty.nl/IATIactivitystandaard_AINL_1stquarter2017.xml
4 amnesty amnesty-2 http://50jaar.amnesty.nl/IATIactivityorganisation_AINL1stquarter2017(f).xml
1 britishcouncil britishcouncil-activities
1 cafod cafod-latinamericageneral
8 cafod cafod-multipleglo http://www.cafod.org.uk/extra/data/iati/IATIFile_Multiple_GLO.xml
4 cafod cafod-yemenarabrepublic http://www.cafod.org.uk/extra/data/iati/IATIFile_Yemen_Arab_Republic.xml
1 cdc cdc-activity
8 ec-fpi ec-fpi-gm http://ec.europa.eu/europeaid/files/iati/XI-IATI-EC_FPI_C_GM.xml
1 ewb_canada ewb_canada-water_sanitation_2011
8 fco fco-20131231_4 https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/322661/Official_Development_Assistance__ODA__Frontline_2013-14_Q3_-_XML_format.xml
@Vankalif
Vankalif / mosaic.vlm
Last active April 24, 2024 21:26
VLC 6 ip cameras mosaic config via RTSP
# Runs on windows by command -> vlc --vlm-conf path_to_file.vlm
# Background options
new bg broadcast enabled
# bg just plain black background jpg image
setup bg input "C:\Users\full_path_to\back.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=960,cols=3,rows=2,position=1,order="1,2,3,4,5,6",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,vb=2000,fps=15}:duplicate{dst=display}
# Input options
@stgraber
stgraber / commands
Created March 22, 2022 22:23
LXD cluster with CEPH, OVN and Grafana on Google Compute
# Deploy the LXD cluster
juju bootstrap google/northamerica-northeast1 gce
juju deploy ./lxd-gce.yaml
juju add-storage ceph-osd/0 osd-devices=gce,100G,1
juju add-storage ceph-osd/1 osd-devices=gce,100G,1
juju add-storage ceph-osd/2 osd-devices=gce,100G,1
juju add-storage ceph-osd/3 osd-devices=gce,100G,1
juju add-storage ceph-osd/4 osd-devices=gce,100G,1
# Expose the services
@techhazard
techhazard / Readme.md
Last active January 26, 2024 16:23
NixOS: PCI Passthrough

PCI Passthrough

Warning: unfinished (but successfull!)

I did PCI passthrough on Archlinux and Debian with the old PCI-stub method (this was pre-4.0 era). And later I did PCI passthrough on the 4.1+ kernels on Arch and Ubuntu (16.10 I think?).

This is my attempt at doing the same on Nixos.

Requirements

import { useState } from "react";
import { motion } from "framer-motion";
import city1 from "../assets/city1.png";
import city2 from "../assets/city2.png";
import city3 from "../assets/city3.png";
import planet1 from "../assets/planet1.png";
import planet2 from "../assets/planet2.png";
const ImageSlider = () => {
const [positionIndexes, setPositionIndexes] = useState([0, 1, 2, 3, 4]);