Skip to content

Instantly share code, notes, and snippets.

@demirdegerli
demirdegerli / ubuntu_debloater.sh
Last active May 25, 2024 22:06
Ubuntu Debloater
#!/bin/sh
if [ "$(whoami)" != "root" ]; then
echo "Please run this script as root."
exit
fi
printf "This script will\n\n- Remove Snap\n- Install the deb version of Firefox\n- Install Flatpak\n- Optionally replace Ubuntu Desktop with GNOME\n\n"
read -p "Continue? (Y/n) " start_prompt
case $start_prompt in
[nN] | [nN][oO] )
exit
@csantanapr
csantanapr / bash_strict_mode.md
Created November 17, 2020 18:26 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o pipefail explanation

set -e, -u, -o pipefail

The "set" lines These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing. With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.

set -euo pipefail is short for:

set -e
set -u
#!/usr/bin/env sh
set -- $(locale LC_MESSAGES)
yesptrn="$1"; noptrn="$2"; yesword="$3"; noword="$4"
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
input_sink=$(pacmd stat |grep -o -P "(?<=Default source name: ).*")
output_sink=$(pacmd stat |grep -o -P "(?<=Default sink name: ).*")
echo "Input:" $input_sink
@diyfr
diyfr / docker-compose.yml
Last active May 1, 2023 05:34
Basic secured configuration for Traefik V2.X
version: '3.5'
services:
proxy:
image: traefik:v2.1
# The official v2.0 Traefik docker image
container_name: proxy
networks:
- traefik
ports:
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active June 18, 2024 07:51
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@agarciamontoro
agarciamontoro / UGRApp.md
Last active September 28, 2017 12:33
UGRApp: propuestas de mejora y solicitud de información

UGRApp: propuestas de mejora y solicitud de información

Introducción

La Universidad de Granada (UGR) lleva unos meses publicitando su nueva aplicación oficial: la UGRApp. Esta aplicación permite el acceso a la Tarjeta Universitaria Inteligente (TUI) en su versión digital, consulta de las calificaciones, el listado de asignaturas, los horarios de clases, el menú de los comedores universitarios, el catálogo de la biblioteca, realizar trámites administrativos... En definitiva, pretende funcionar como intermediaria entre el alumnado y la Universidad.

Tras los primeros anuncios de la aplicación por parte de la UGR, un grupo de miembros de la comunidad universitaria granadina decidió analizar la aplicación para verificar que era segura. En este primer análisis se detectaron varios problemas. Tras debatir los pasos a seguir para frenar los peligros que esta aplicación crea, y después de estar en contacto con D. José Ángel Ibáñez Zapata ---Director de Comunicación de la UGR---, que se ofreció como intermediar

@ololobus
ololobus / create-and-fill-up-table.sql
Last active May 21, 2024 10:58
Create large ~1 GB random dataset in PostgreSQL
CREATE TABLE large_test (num1 bigint, num2 double precision, num3 double precision);
INSERT INTO large_test (num1, num2, num3)
SELECT round(random()*10), random(), random()*142
FROM generate_series(1, 20000000) s(i);
EXPLAIN (analyse, buffers)
SELECT num1, avg(num3) as num3_avg, sum(num2) as num2_sum
FROM large_test
GROUP BY num1;
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@angrykoala
angrykoala / hasselhoffinator.sh
Last active July 11, 2017 10:16
hasselhoffinator
#!/bin/bash
#hasselhoff attack taken to a new level
#@angrykoala
DIR=/home/$(whoami)/hasselhoff.jpg
MESSAGE="you have been hasselhoffed"
IMAGE_URL=http://www.ljpaez.es/imagen/hasselhoff.jpg
wget $IMAGE_URL -q
mv ./hasselhoff.jpg $DIR
gsettings set org.gnome.desktop.background picture-uri file://$DIR