Skip to content

Instantly share code, notes, and snippets.

@bogdanRada
bogdanRada / Dockerfile
Created July 11, 2023 18:03 — forked from nginx-gists/Dockerfile
Dockerfiles for NGINX Plus R29 (Alpine Linux 3.17 and Debian bullseye -11-), from “Deploying NGINX and NGINX Plus with Docker”
FROM debian:bullseye-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
# Define NGINX versions for NGINX Plus and NGINX Plus modules
# Uncomment this block and the versioned nginxPackages block in the main RUN
# instruction to install a specific release
# ENV NGINX_VERSION 29
# ENV NJS_VERSION 0.7.12
# ENV PKG_RELEASE 1~bullseye
@bogdanRada
bogdanRada / fix_jar_mime.sh
Created April 10, 2023 11:01 — forked from flying-sheep/fix_jar_mime.sh
A bug exists for ages in Kubuntu (and afaik only there) that can be fixed by removing a superfluous file and rebuilding the MIME DB.
#!/bin/bash
ROOT_UID=0
FIX_JAR_MIME="rm -vf /usr/share/mime/packages/sun-java*-jre.xml
update-mime-database /usr/share/mime"
if [ "$UID" -ne "$ROOT_UID" ]; then
kdesudo -c "$FIX_JAR_MIME"
kbuildsycoca4 #only possible if run as underprivileged
else
"$FIX_JAR_MIME"
@bogdanRada
bogdanRada / BrowserGlue.jsm
Created February 28, 2023 10:19 — forked from wellington1993/BrowserGlue.jsm
view-source:resource:///modules/BrowserGlue.jsm
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var EXPORTED_SYMBOLS = ["BrowserGlue", "ContentPermissionPrompt"];
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
@bogdanRada
bogdanRada / readme.md
Created February 28, 2023 10:06 — forked from jimmywarting/readme.md
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
# Serving Random Payloads with NGINX
# add set_random module https://github.com/openresty/set-misc-nginx-module#set_random
# edit file /etc/nginx/sites-enabled/default
set_random $uri 1 3;
map $uri $payloads {
1 /payload.lnk;
2 /payload.hta;
3 /payload.exe;
@bogdanRada
bogdanRada / grpc_ruby_gzip.rb
Created January 26, 2023 20:16 — forked from fallwith/grpc_ruby_gzip.rb
Ruby grpc gem with gzip compression demonstration
#!/usr/bin/env ruby
# frozen_string_literal: true
# This standalone Ruby script is intended to demonstrate the use of the 'grpc'
# gem to establish a minimal unary rpc and spawn both a gRPC server and client
# and have them use gzip to compress content being sent to one another after
# the client requests the use of gzip at channel creation, stub creation, and
# call time.
#
# Instructions:
@bogdanRada
bogdanRada / .rubocop.yml
Created December 6, 2022 21:30 — forked from hulous/.rubocop.yml
Basecamp rubocop config inspiration. This template is inspired on https://gist.githubusercontent.com/lazaronixon/7815d84702f277ead5e89c9f2aa5581f/raw/rubocop.yml
# This template is inspired on https://gist.githubusercontent.com/lazaronixon/7815d84702f277ead5e89c9f2aa5581f/raw/rubocop.yml
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
Rails:
Enabled: true
@bogdanRada
bogdanRada / api_only_rails_example.rb
Created December 6, 2022 18:46 — forked from JoshCheek/api_only_rails_example.rb
How to configure API only Rails (esp how to deal with param parsing).
# I submitted a bug report https://github.com/rails/rails/issues/34244
# b/c Rails was not honouring my `rescue_from` block which was causing my API to
# be inconsistent. I was told this is expected behaviour. I think it's probably
# fine for an HTML app where you control the form inputs. But for an API app,
# the API is public facing and very important, so Rails shouldn't have its own
# special errors that bypass my app's configuration and make my API inconsistent.
#
# Decided it shouldn't be too difficult to handle this myself. So, here is my
# solution. It contains most of the important lessons I've learned about how to
# get a Rails API app setup. It removes Rails' params parsing and adds its own.
@bogdanRada
bogdanRada / qemu-arm.md
Created October 13, 2022 06:43 — forked from rgl/qemu-arm.md
run emulated arm under qemu

This will show how to run an emulated arm64 virtual machine under qemu.

It first shows how to launch a typical amd64 virtual machine to make sure we have cloud-init working.

Then it shows how to launch the arm64 (aka aarch64) virtual machine.

NB In my humble i3-3245 amd64 host this is way too slow to run anything useful as it takes about 6m to allow you to finally login, and after that, its slow too. You are really better off with a proper physical arm64 machine, like:

@bogdanRada
bogdanRada / intel-nvidia.md
Created October 7, 2022 06:46 — forked from wangruohui/intel-nvidia.md
Intel for display, Nvidia for computing

Intel for display, NVIDIA for computing

This guide will show you how to use Intel graphics for rendering display and NVIDIA graphics for CUDA computing on Ubuntu 18.04 / 20.04 desktop.

I made this work on an ordinary gaming PC with two graphics devices, an Intel UHD Graphics 630 plus an NVIDIA GeForce GTX 1080 Ti. Both of them can be shown via lspci | grep VGA.

00:02.0 VGA compatible controller: Intel Corporation Device 3e92
01:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)