Skip to content

Instantly share code, notes, and snippets.

View ngerakines's full-sized avatar
🏠
Working from home

Nick Gerakines ngerakines

🏠
Working from home
View GitHub Profile
package main
import (
"fmt"
"time"
"github.com/carlmjohnson/crockford"
)
func encodeInt64(value int64) string {
@ngerakines
ngerakines / README.md
Last active February 23, 2024 20:10
Running your own atproto pds

README

First, understand a few things:

  1. Every identity has a unique did (distributed identifier) that looks like this: did:plc:cbkjy5n7bk3ax2wplmtjofq2

  2. You can alias a domain to your did.

    dig +short TXT _atproto.ngerakines.me
    "did=did:plc:cbkjy5n7bk3ax2wplmtjofq2"
    
@ngerakines
ngerakines / _etc_nginx_nginx.conf
Created December 15, 2020 20:13
Integrate your Pleroma blocklist with nginx (replace _ with / for original filenames)
# Your main nginx config file.
http {
# Existing configuration…
# Enable blocks based on IPs used by Fediverse instance domain names.
include /etc/nginx/blocklist-ip.conf;
}
package main
import (
"bufio"
"encoding/json"
"fmt"
"net/http"
"os"
"github.com/kr/pretty"
// (c) 2019 Nick Gerakines
// This code is licensed under MIT license
#include <signal.h>
#include <thread>
#include <chrono>
#include "cpprest/http_listener.h"
using namespace std;
using namespace web;
cmake_minimum_required(VERSION 3.7)
project(main)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
find_package(cpprestsdk CONFIG REQUIRED)
find_package(Boost COMPONENTS system REQUIRED)
FROM ubuntu as build
RUN apt-get update && apt-get install -y build-essential git cmake autoconf libtool pkg-config libcpprest-dev libcpprest
WORKDIR /src
COPY CMakeLists.txt main.cpp ./
RUN cmake . && make
FROM ubuntu as app
RUN apt-get update && apt-get install -y libcpprest
WORKDIR /app
COPY --from=build /src/main ./
@ngerakines
ngerakines / CMakeLists.txt
Last active September 9, 2019 13:27
cpprestsdk demo
cmake_minimum_required(VERSION 3.7)
project(main)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
find_package(cpprestsdk CONFIG REQUIRED)
find_package(Boost COMPONENTS system REQUIRED)
docker run --rm -i -p 5003:5003 docker.pkg.github.com/sslhound/svger/svger:dev /app/svger --backend https://img.shields.io --backend-insecure=true --enable-post=false
[2019-09-07 16:50:42.922] [info] svger starting up environment=development listen=0.0.0.0 backend=https://img.shields.io
[2019-09-07 16:50:42.927] [info] Started server on http://0.0.0.0:5003/
curl -vv -skH "Content-Type: image/svg+xml" --data "@badge.svg" http://localhost:5003/ > badge.png
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 5003 (#0)
> POST / HTTP/1.1
> Host: localhost:5003
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.