Skip to content

Instantly share code, notes, and snippets.

@denibertovic
denibertovic / dropbox.log
Created July 12, 2023 15:21
nixos 23.05 with home-manager - dropbox fails to start
Jul 12 17:14:23 t142020 c9ycd2sglvjsxki79j5c9qsnphyb10kp-dropbox-start[492348]: Dropbox is the easiest way to share and store your files online. Want to learn more? Head to https://www.dropbox.com/
Jul 12 17:14:23 t142020 c9ycd2sglvjsxki79j5c9qsnphyb10kp-dropbox-start[492348]: In order to use Dropbox, you must download the proprietary daemon.
Jul 12 17:14:35 t142020 c9ycd2sglvjsxki79j5c9qsnphyb10kp-dropbox-start[492348]: Note: python3-gpg (python3-gpgme for Ubuntu 16.10 and lower) is not installed, we will not be able to verify binary signatures. [y/n]
Jul 12 17:14:35 t142020 c9ycd2sglvjsxki79j5c9qsnphyb10kp-dropbox-start[492469]: dropbox: load fq extension '/home/deni/.dropbox-hm/.dropbox-dist/dropbox-lnx.x86_64-177.4.5399/cryptography.hazmat.bindings._openssl.abi3.so'
Jul 12 17:14:35 t142020 c9ycd2sglvjsxki79j5c9qsnphyb10kp-dropbox-start[492469]: dropbox: load fq extension '/home/deni/.dropbox-hm/.dropbox-dist/dropbox-lnx.x86_64-177.4.5399/cryptography.hazmat.bindings._padding.abi3.so'
Jul 12 17:14:35 t1
@denibertovic
denibertovic / ipmi-thresholds.md
Last active June 29, 2023 12:50
Example for setting fan threshold with IPMI

set password

export IPMI_PASSWORD=xxxxx

USAGE info:

   id        : name of the sensor for which threshold is to be set
   threshold : which threshold to set
                 unr = upper non-recoverable
@denibertovic
denibertovic / aranet4-sensors.sh
Created September 21, 2022 12:52
A script that puts aranet4 sensor data into Prometheus' textfile collector format
#!/run/current-system/sw/bin/bash
TEXTFILE_COLLECTOR_DIR="/opt/prometheus/textfilecollector"
FILE_DATA="${TEXTFILE_COLLECTOR_DIR}/aranet4-sensor-data.prom"
FILE_DATA_NEW="/tmp/aranet4-sensor-data-new"
SENSOR_MAC="xx:yy:xx:yy:xx:yy"
SENSOR_NAME="aranet4"
EXIT_CODE=1
until [ ${EXIT_CODE} -eq 0 ]; do
@denibertovic
denibertovic / entrypoint.sh
Created November 16, 2021 17:09
Docker entrypoint.sh example with docker group for running sibling containers
#!/bin/bash
# Add docker group
groupadd docker --gid ${DOCKER_GROUP_ID:-129}
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
# The user is added to the docker group to be able to start containers
@denibertovic
denibertovic / example.sh
Created September 15, 2021 16:16
Automatically start screen from .bashrc
# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen
# if we're coming from a remote SSH connection, in an interactive session
# then automatically put us into a screen(1) session. Only try once
# -- if $STARTED_SCREEN is set, don't try it again, to avoid looping
# if screen fails for some reason.
if [ "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_SCREEN=1 ; export STARTED_SCREEN
screen -RR -S main || echo "Screen failed! continuing with normal bash startup"
fi
@denibertovic
denibertovic / s3-restrict-vpc.tf
Created June 29, 2021 15:20
Restrict access to public s3 bucket within VPC
resource "aws_vpc_endpoint" "s3" {
vpc_id = module.vpc.vpc_id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [module.public-gateway.route_table_id]
}
resource "aws_s3_bucket" "static" {
acl = "public-read"
bucket = "${var.name_prefix}-static"
@denibertovic
denibertovic / s3-static-file-ingress-and-svc.yaml
Created June 29, 2021 15:10
Proxy static files from S3 with Kubernetes and Nginx Ingress
apiVersion: v1
kind: Service
metadata:
name: my-s3-static-svc
spec:
externalName: <MY_S3_BUCKET_NAME>.s3.<MY_S3_BUCKET_REGION>.amazonaws.com
type: ExternalName
ports:
- name: http
port: 80
@denibertovic
denibertovic / twitter-lists.py
Created January 12, 2021 09:21
Creating twitter lists from followers
import twitter
import os
CONSUMER_KEY = os.environ['CONSUMER_KEY']
CONSUMER_SECRET = os.environ['CONSUMER_SECRET']
ACCESS_TOKEN = os.environ['ACCESS_TOKEN']
ACCESS_TOKEN_SECRET = os.environ['ACCESS_TOKEN_SECRET']
LIST_ID = os.environ['TWITTER_LIST_ID']
@denibertovic
denibertovic / release.nix
Created November 8, 2019 16:47
Useful template compiling a Haskell project with Nix
{ compiler ? "ghc864" }:
let
# Disable tests for these packages
dontCheckPackages = [
];
# Jailbreak these packages
doJailbreakPackages = [
];
@denibertovic
denibertovic / Dockerfile
Created January 12, 2019 10:20
Dockerfile with buildkit (experimental support)
# syntax = docker/dockerfile:experimental
FROM ubuntu:18.04 as build
# This is phase1: the build phase
# where we build our project and output a binary
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
apt-transport-https \