Skip to content

Instantly share code, notes, and snippets.

import pathlib
import sys
import glob
import os
import io
from PIL import Image
def main():
#!/bin/bash
all_devices=($(ls /sys/block/))
usb_devices=()
for device in "${all_devices[@]}"
do
if readlink -f "/sys/block/$device/device" | grep -q "usb"
then
usb_devices+=($device)
import string
substitutions = {
'a': ['@'],
'b': ['8'],
'c': ['('],
'd': ['6'],
'e': ['3'],
'f': ['#'],
'g': ['9'],
import argparse
import os
import sys
import geopandas
import matplotlib.pyplot as plt
def main(argv):
parser = argparse.ArgumentParser()

Why is numpy's matrix multiplication faster than matrix multiplication implemented in plain python?

numpy's matrix multiplication are written in c/c++ which means they can be pre-compiled to give better performance

Why can't we compile python code?

compiling python code is posible if someone writes a compiler for it, through this is very hard and no one has done it yet, but there are compilers which compile some parts of the python code

What is numba?

import json
import tkinter as tk
import urllib.error
import urllib.request
from tkinter import ttk
def get_user_info(handle):
url = "https://codeforces.com/api/user.info?handles={}".format(handle)
import urllib.request
import json
import os
from telegram.ext import Updater, CommandHandler
def count(update, context):
with urllib.request.urlopen('https://api.github.com/orgs/fedora-infra/repos') as res:
repos = json.load(res)
import argparse
import json
import sys
import urllib.parse
import urllib.request
GOOGLE_API_KEY = "AIzaSyDlTbpjDV_Zh1twcJAP5wqA5fufFd11o5o"
# GOOGLE_API_URL = "https://www.googleapis.com/customsearch/v1/siterestrict"
GOOGLE_API_URL = "https://www.googleapis.com/customsearch/v1"
GOOGLE_SEARCH_ENGINE_ID = "009028027573556014028:bsh42hbg5d2"
import argparse
import json
import sys
import urllib.request
API_KEY = "3fa3ce845ba490db8c3e47719672ed5d0ef66739"
USER_AGENT = "gci-reverse-whois/1.0"
def main(argv):
*:8080 {
gzip
tls self_signed
root /usr/share/caddy
}
import caddy.conf.d/*.conf