Skip to content

Instantly share code, notes, and snippets.

View dbanetto's full-sized avatar
🐦

David Barnett dbanetto

🐦
View GitHub Profile
@dbanetto
dbanetto / README.md
Created August 15, 2023 01:36
GNOME 44 Auto-rotate desktop background

Automaticly rotating wallpapers in Gnome 44

This method uses a

  • shell script to update the relvant gsettings
  • Systemd service to run the script
  • Systemd timer to periodically run the script

Installation

1. Copy & update scipt

@dbanetto
dbanetto / change_deafult_branch.sh
Created June 20, 2020 04:09
Change the default branch for a new git repo
echo 'ref: refs/heads/main' > /usr/share/git-core/templates/refs
FROM python:3.8-alpine
RUN apk add --no-cache --virtual builddeps gcc musl-dev && \
pip --no-cache-dir install aws-sam-cli && \
apk del builddeps
@dbanetto
dbanetto / cargo-binupdate.sh
Created October 23, 2016 05:13
cargo command to update all installed executables
#!/bin/sh
cargo install --list | grep ':$' | sed 's/\(^.*\)\s.*/\1/' | xargs -t -I _ cargo install _
# install script into $PATH
# use via `cargo binupdate`
# also accepts `cargo binupdate --force`
@dbanetto
dbanetto / zshenv
Created October 23, 2016 04:49
zshenv for cargo/rustup in ~/.local/share
if (( SHLVL > 1 )); then
return 1
fi
export RUST_SRC_PATH=~/.local/share/rustup/toolchains/<triple for sys>/lib/rustlib/src/rust/src
export CARGO_HOME=~/.local/share/cargo
export RUSTUP_HOME=~/.local/share/rustup
@dbanetto
dbanetto / README.md
Last active April 23, 2018 08:50
Systemd service to lazily start postgres when you need it

Lazy Postgres

A systemd service to activate postgresql only when you need it

Install

requires: Postgresql and Systemd

  • create postgresql.socket into /usr/lib/systemd/system
  • run sudo systemctl enable postgresql.socket to enable the socket service
@dbanetto
dbanetto / tmx
Last active December 5, 2015 10:49
#!/bin/bash
#
# Modified TMUX start script from:
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html
#
# Store it to `~/bin/tmx` and issue `chmod +x`.
#
# Works because bash automatically trims by assigning to variables and by
#!/usr/bin/env python3
#
# Requires Python 3, and requests
#
# Tested on Linux, python 3.4, requests 2.6.0
#
import requests
import json, time, datetime, re
@dbanetto
dbanetto / binarystring
Created May 18, 2014 02:05
Solves : encoding/decoding two binary strings together into one binary string
#!/usr/bin/python3
def main():
print (decode(encode("101" , "1011")))
print (decode(encode("1101" , "1011")))
print (decode(encode("10010101" , "1011")))
# Reads read the source C
# Decodes by getting the 1st 2 bits from the string
# 1st bit (from left) is the End of String bit
import random
#Edit for player list
players = [ "Lukos", "david", "elf_and_safety", "jack" , "sefirosu" , "supa_kappa" , "Nantres", "orange_lightning" ]
#Hardcode people to be in a team like so:
dire = ["Blake"]
rad = ["Daniel"]
#debug
#print (len(dire) , len(rad))