Skip to content

Instantly share code, notes, and snippets.

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

Konrad Rymczak teserak

🏠
Working from home
View GitHub Profile
@teserak
teserak / HttpProxy.go
Created May 8, 2023 11:29 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@teserak
teserak / 01_scripts_and_styles.js
Created March 22, 2023 22:25 — forked from sesgoe/01_scripts_and_styles.js
Retool Realtime WebSocket
const webSocket = new WebSocket('wss://echo.websocket.org');
//Event listeners are the pillars upon which WebSockets are built. This event fires when the WebSocket is considered 'OPEN',
//which means that it has connected successfully.
webSocket.addEventListener('open', function(event) {
console.log('websocket connected successfully') //log this into the browser console so we can check if the websocket connected
});
//This is a global reference to the websocket that we created. We need this because otherwise multiple JS
@teserak
teserak / .gitconfig
Created August 4, 2022 07:57 — forked from natescode/.gitconfig
Git Aliases to make GIT easier to work with
[user]
email = your_email
name = your_username
[alias]
# git clone
cl = !git clone
# Git shallow clone for large repos
clq= !git clone --depth=1
s = status
co = checkout
@teserak
teserak / marc_to_json.snippet.py
Created May 20, 2022 09:31 — forked from miku/marc_to_json.snippet.py
Convert MARC to json
def marc_to_dict(marcobj):
control_fields = ('001', '002', '003', '004', '005', '006', '007', '008', '009')
jsonobj = {}
jsonobj['leader'] = marcobj.leader
jsonobj['fields'] = []
for field in marcobj.fields:
if field.tag in control_fields:
jsonobj['fields'].append( { field.tag : re.escape(field.data) } )
else:
subdict = {}
@teserak
teserak / fastapi_websocket_redis_pubsub.py
Created February 14, 2022 16:39 — forked from timhughes/fastapi_websocket_redis_pubsub.py
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
@teserak
teserak / labels.md
Created February 8, 2021 00:41 — forked from andrew/labels.md
Popular labels from issues and pull requests on open source GitHub repositories - Pulled from https://libraries.io
Label Count
auto-migrated 1062577
Priority-Medium 852268
Type-Defect 783536
enhancement 505553
bug 377913
Type-Enhancement 155995
question 102693
feature 60043
@teserak
teserak / ISO_3166-1_countries_pl.js
Created January 10, 2021 12:41 — forked from lukaszfiszer/ISO_3166-1_countries_pl.js
List of all countries with their ISO 3166-1 codes, polish and english names, in javascript and json. Sorted by polish name. Source: http://pl.wikipedia.org/wiki/ISO_3166-1 Lista wszystkich państw świata wraz z ich polską i angielską nazwą oraz kodem wg. ISO 3166-1, w formatach javascript i JSON. Posortowana wg. polskiej nazwy: Zródło: http://pl.…
[
{ name_pl: "Afganistan", name_en: "Afghanistan", code: "AF" },
{ name_pl: "Albania", name_en: "Albania", code: "AL" },
{ name_pl: "Algieria", name_en: "Algeria", code: "DZ" },
{ name_pl: "Andora", name_en: "Andorra", code: "AD" },
{ name_pl: "Angola", name_en: "Angola", code: "AO" },
{ name_pl: "Anguilla", name_en: "Anguilla", code: "AI" },
{ name_pl: "Antarktyka", name_en: "Antarctica", code: "AQ" },
{ name_pl: "Antigua i Barbuda", name_en: "Antigua and Barbuda", code: "AG" },
{ name_pl: "Arabia Saudyjska", name_en: "Saudi Arabia", code: "SA" },
@teserak
teserak / docker-compose.deploy.volumes-placement.yml
Created September 17, 2020 19:47 — forked from dmontagu/docker-compose.deploy.volumes-placement.yml
Elasticsearch config files for use with FastAPI generated project
version: '3.3'
services:
db:
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
deploy:
placement:
constraints:
- node.labels.${STACK_NAME}.app-db-data == true
es01:
@teserak
teserak / .gitconfig
Created July 21, 2020 05:01 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
@teserak
teserak / openresty-nchan-redis-luarocks.sh
Created January 4, 2020 22:51 — forked from jmealo/openresty-nchan-redis-luarocks.sh
OpenResty + LuaRocks + Nchan + Redis (with password, graph and bloom modules)
#!/bin/sh
apt-get install -y libreadline-dev libncurses5-dev libpcre3-dev \
libssl-dev perl make build-essential git curl \
unzip
git clone https://github.com/RedisLabsModules/password.git /tmp/password
git clone https://github.com/RedisLabsModules/rebloom.git /tmp/rebloom
git clone https://github.com/RedisLabsModules/redis-graph.git /tmp/redis-graph