Skip to content

Instantly share code, notes, and snippets.

View rgs1's full-sized avatar
🎯
Focusing

Raúl Gutiérrez Segalés rgs1

🎯
Focusing
View GitHub Profile
from pync import Notifier
from Foundation import NSUserNotificationCenter, NSObject, NSRunLoop, NSDate
class NotificationDelegate(NSObject):
def userNotificationCenter_didDeliverNotification_(self, center, notification):
title = notification.title()
subtitle = notification.subtitle()
message = notification.informativeText()
print(f"Received notification:\nTitle: {title}\nSubtitle: {subtitle}\nMessage: {message}\n")
from pync import Notifier
import time
def show_notification(title, subtitle, message):
Notifier.notify(
message,
title=title,
subtitle=subtitle,
sound='default',
timeout=10
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/mail"
"os"
)
Buffer::OwnedImpl buffer;
auto result = bio_io_handle(b)->read(buffer, outl);
/* TODO: avoid copying */
buffer.copyOut(0, buffer.length(), out);
auto fragment = new Buffer::BufferFragmentImpl(out, outl,
[](const void*, size_t, const Buffer::BufferFragmentImpl* this_fragment) {
delete this_fragment;
});
Buffer::OwnedImpl buffer;
buffer.addBufferFragment(*fragment);
// en source/extensions/transport_sockets/tls/io_handle_bio.cc
// NOLINTNEXTLINE(readability-identifier-naming)
int io_handle_read(BIO* b, char* out, int outl) {
if (out == nullptr) {
return 0;
}
Buffer::BufferFragmentImpl fragment(out, outl,
[](const void*, size_t,
#!/usr/bin/env python3.7
import argparse
import json
import random
import string
def get_params():
parser = argparse.ArgumentParser()
{
"admin": {
"access_log_path": "/tmp/admin_access.log",
"address": {
"socket_address": {
"protocol": "TCP",
"address": "127.0.0.1",
"port_value": 9904
}
}
...
{
"name": "prod",
"capacity": 0.995
},
{
"name": "canary",
"capacity": 0.005
}
...
{
"name": "prod",
"capacity": 0.995
},
{
"name": "canary",
"capacity": 0.005
}