Skip to content

Instantly share code, notes, and snippets.

@kraftwerk28
kraftwerk28 / blockmark.lua
Created February 25, 2024 11:17
Treesitter Blockmark
local api = vim.api
local queries = {
lua = {
comment = "-- ",
queries = {
[[
(function_declaration name: (identifier) @name) @body
]],
[[
import sys
from asyncio import open_connection, run
import aiofiles
async def main(args):
reader, writer = await open_connection(port=8080)
if len(args) >= 2 and args[0] == "--send":
writer.write(b"send\n")
import { useRef, useState, useEffect, createContext, useContext } from 'react';
type ExecuteResponse = { key: string; response: string };
type HCaptchaContext = {
widgetId: string | undefined;
setWid(wId: string | undefined): void;
loading: boolean;
getToken(): Promise<string>;
setExecutePending(v: boolean): void;
};
@kraftwerk28
kraftwerk28 / main.c
Created May 23, 2022 22:45
Telegram bot in C using json-c & libcurl
#include <assert.h>
#include <curl/curl.h>
#include <json.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const char *API_URL = "https://api.telegram.org";
struct response {
import emoji
import gzip
from io import BytesIO
import json
import logging
from pyrogram import filters, types
from pyrogram.raw.functions.messages import GetStickerSet
from pyrogram.raw.functions.upload import GetFile
from pyrogram.raw.types import (
@kraftwerk28
kraftwerk28 / main.c
Created May 3, 2022 10:07
xdg-activation-v1
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/input-event-codes.h>
#include <poll.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fcntl.h> /* For O_* constants */
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <unistd.h>
#include <wayland-client.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <wayland-client.h>
#include <wayland-server.h>
static struct wl_display *display = NULL;
static struct wl_event_loop *loop = NULL;
static bool running = true;
@kraftwerk28
kraftwerk28 / main.c
Created April 17, 2022 17:00
xdg activation v1 demo
#include <fcntl.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <wayland-client.h>
version: "3"
services:
ovpn:
image: dperson/openvpn-client
cap_add:
- NET_ADMIN
security_opt:
- label:disable