Skip to content

Instantly share code, notes, and snippets.

@jamct
jamct / docker-compose.env
Created April 18, 2024 08:16
Docker-Compose for Paperless-ngx
# The UID and GID of the user used to run paperless in the container. Set this
# to your UID and GID on the host so that you have write access to the
# consumption directory.
USERMAP_UID=1028
USERMAP_GID=100
# Additional languages to install for text recognition, separated by a
# whitespace. Note that this is
# different from PAPERLESS_OCR_LANGUAGE (default=eng), which defines the
#!/usr/bin/env python
"""
Simple script to transform openscale csv export files to a format accepted by garmin connect at
https://connect.garmin.com/modern/import-data
Note: When importing the language needs to be set to English, otherwise the import fails.
Set everything to metric units and to YYYY-MM-DD date format.
If you want to compute BMI for the file give your height (im meters) as second parameter.
@lokhman
lokhman / ubuntu-hardening.md
Last active April 20, 2024 08:17
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

@mda590
mda590 / boto3_listinstances_example.py
Last active April 20, 2024 08:15
Example using boto3 to list running EC2 instances
import boto3
ec2 = boto3.resource('ec2')
def lambda_handler(event, context):
# create filter for instances in running state
filters = [
{
'Name': 'instance-state-name',
'Values': ['running']
@Guhan-SenSam
Guhan-SenSam / 1info.md
Last active April 20, 2024 08:15
Methods to Optimizing Kivy Performance

Many people state that kivy is slow. While this may be true it is mostly due to that python is slow to run on android devices.Thus it is in the programmer's hands to properly optimize their code so as to create a performant application.

Most of the lag on android devices runing kivy apps arise due to widget creation. Widget creation remains the slowest step in a kivy app. Here are some of the methods that I follow to optimize my apps and ensure I can hit 60fps even on old devices

Optimization Methods:

@erikyuzwa
erikyuzwa / wordpress-6-2-2-docker-compose.yml
Last active April 20, 2024 08:13
Wordpress 6.2.2 Docker Compose for Local Development
# create a local .env file with the following 4 properties:
#
# MYSQL_DATABASE=<something>
# MYSQL_USER=<something>
# MYSQL_PASSWORD=<something>
# MYSQL_ROOT_PASSWORD=<something>
#
# Note: I have had a LOT of issues working with anything newer then Docker Desktop v4.26.1
# If you're on something newer, then double check against this release.
#
@paradite
paradite / LICENSE
Last active April 20, 2024 08:12
d3.js range selection using drag
MIT License
Copyright (c) 2020 Zhu Liang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Two approaches to handle error responses from Spring WebClient calls globally:

  • Exceptions with webclients are all wrapped in WebClientResponseException class. So we can handle that using Spring's ExceptionHandler annotation.

  • Using ExchangeFilterFunction while constructing the webclient bean.

@andyblac
andyblac / low-battery-and-unavailable-check.yaml
Last active April 20, 2024 08:08 — forked from kurohouou/low-battery-and-unavailable-check.yaml
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
# Version: 1.3.1
name: Low Battery and Device Unavailable Check
description:
Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold as well as if it is unavailable.
domain: automation
input:
threshold:
name: Battery warning level threshold
@hhanh00
hhanh00 / reverse-ws-proxy.js
Created June 24, 2015 15:05
Reverse Proxy for websockets using Express JS
var http = require('http'),
httpProxy = require('http-proxy'),
express = require('express');
// create a server
var app = express();
var proxy = httpProxy.createProxyServer({ target: 'http://localhost:8080', ws: true });
var server = require('http').createServer(app);
// proxy HTTP GET / POST