⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.ConstrainedExecution; | |
using System.Runtime.InteropServices; | |
using OpenTK; | |
public class GlxBindingsContext : IBindingsContext | |
{ | |
[DllImport("libGL", CharSet = CharSet.Ansi)] | |
private static extern IntPtr glXGetProcAddress(string procName); | |
public IntPtr GetProcAddress(string procName) |
As a developer I have noticed a trend in libraries where the library developer will write this amazing
library that does everything you need it to except that it has a .run()
or .start()
method. The
intent is for the user of said library to do the initialization code in the application entry point
and then do something like return app.run();
. Whether it's in Python, Java, C++, or Rust they all
abstratct away the application's main event loop.
What is an event loop?
I hereby claim:
- I am jetstreamin on github.
- I am dysk0n3kt (https://keybase.io/dysk0n3kt) on keybase.
- I have a public key ASAx8H2rgt-74CDv7SGAuwcWvbA67ooI0WNLhIl6_UHMPwo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-2.0 | |
/* | |
* @author Ammar Faizi <[email protected]> https://www.facebook.com/ammarfaizi2 | |
* @license GPL-2.0 | |
* @package tgvisd::Main::Preload | |
* | |
* Copyright (C) 2021 Ammar Faizi <[email protected]> | |
*/ | |
#if defined(__linux__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Text; | |
using System.IO; | |
using System.Collections; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using System.Text.Json.Serialization; | |
using System.Text.Json; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from httpx import AsyncClient | |
class SpotifyUser: | |
authorize_url = "https://accounts.spotify.com/authorize" | |
token_url = "https://accounts.spotify.com/api/token" | |
def __init__(self, client_id, client_secret, redirect_uri): | |
self.client_id = client_id | |
self.client_secret = client_secret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Лол, код из архива - файл датируется 2017 годом. | |
Написан был после недели изучения C++. | |
Реализует серверную часть чата на клиенте. | |
Код не полный, писался на скорую руку - так сказать proof of concept. | |
О, и да - семафоры это круто :3 */ | |
#include <iostream> | |
#include <string> | |
#include <stdio.h> | |
#include <cstring> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"bytes" | |
"encoding/base64" | |
"encoding/binary" | |
"fmt" | |
"strconv" | |
) | |
func UnpackInlineMessageId(inlineMessageId string) (int64, int64, int64, int64, error) { | |
bs, err := base64.RawURLEncoding.DecodeString(inlineMessageId) |