Skip to content

Instantly share code, notes, and snippets.

@radupotop
radupotop / Reviewing profiles
Last active January 9, 2023 13:57 — forked from mmalone/Reviewing profiles
Replacement Django runserver command that does profiling... because I've rewritten this too many times.
>>> import pstats
>>> p = pstats.Stats('p.1258156459.52174278XcQE.prof')
>>> p.strip_dirs().sort_stats(-1).print_stats(5)
Fri Nov 13 15:54:20 2009 p.1258156459.52174278XcQE.prof
124278 function calls (122386 primitive calls) in 0.589 CPU seconds
Ordered by: standard name
List reduced from 1014 to 5 due to restriction <5>
alias cfg="git --git-dir=$HOME/.cfg --work-tree=$HOME"
alias cfg-tig="env GIT_DIR=$HOME/.cfg GIT_WORK_TREE=$HOME tig"
// Thomann Delete all items from basket.
var items = document.getElementsByClassName('delete-action')
for (var i = 0; i < items.length; i++) {
items[i].click()
}
#!/usr/bin/env python3
import CloudFlare
import argparse
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--email", required=True, help="The Cloudflare login email to use")
parser.add_argument("-n", "--hostname", required=True, help="The hostname to update, e.g. mydyndns.mydomain.com")
parser.add_argument("-k", "--api-key", required=True, help="The Cloudflare global API key to use. NOTE: Domain-specific API tokens will NOT work!")
error: failed to run custom build command for `openssl-sys v0.9.72`
Caused by:
process didn't exit successfully: `/home/alarm/cfddns/src/cfddns-1.6.2/target/release/build/openssl-sys-f45f371ab842d1b0/build-script-main` (exit s
tatus: 101)
--- stdout
cargo:rustc-cfg=const_fn
from celery import current_app
def send_task(name, args=(), kwargs={}, **opts):
task = current_app.tasks[name]
return task.apply(args, kwargs, **opts)
if 'test' in sys.argv:
current_app.send_task = send_task
@radupotop
radupotop / Sequence diagram
Created May 5, 2022 14:25
Mermaid Sequence diagram
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
@radupotop
radupotop / .pylintrc
Created April 29, 2022 08:29
pylintrc
[MESSAGES CONTROL]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time.
#enable=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
@radupotop
radupotop / nginx.conf
Created March 14, 2022 01:08
Nginx default Dummy server
# Nginx default Dummy server
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_reject_handshake on;
return 444;
}
@radupotop
radupotop / iperf-lan-vs-wg.txt
Created March 9, 2022 10:04
iperf results LAN vs WG
iperf3 -c ham.lan -R
Connecting to host ham.lan, port 5201
Reverse mode, remote host ham.lan is sending
[ 5] local 192.168.1.44 port 36732 connected to 192.168.1.3 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 110 MBytes 925 Mbits/sec
[ 5] 1.00-2.00 sec 110 MBytes 921 Mbits/sec
[ 5] 2.00-3.00 sec 111 MBytes 928 Mbits/sec
[ 5] 3.00-4.00 sec 110 MBytes 924 Mbits/sec