Skip to content

Instantly share code, notes, and snippets.

View daniel-illi's full-sized avatar
💭
☕ 💎 🔋

Daniel Illi-Zuberbühler daniel-illi

💭
☕ 💎 🔋
View GitHub Profile
@daniel-illi
daniel-illi / sdcard_fix.md
Created August 6, 2024 20:31 — forked from mvidaldp/sdcard_fix.md
SD card formating fix via ADB shell when Android GUI fails (internal, portable/external or mixed). Works on Retroid Pocket 2+

I wrote this short tutorial because extending my internal storage using my new micro SD card on my Retroid Pocket 2+ failed all the time. Only setting it up as portable/external worked. However, this instructions should work in any Android 5.0+ device.

So, in case you have problems setting up your SD card on your Android device via graphical interface (setting up storage as extended internal memory or portable), and you get a corrupted SD card or any other error, follow these steps to fix it via adb shell:

  1. Make sure you have adb access to your Android device: Settings > System > About, touch/click on Build number until Developer options are enabled:
  2. Go to Settings > System > Developer options and enable USB debugging.
  3. Assuming you have adb installed on your remote terminal run the following:

adb shell

@daniel-illi
daniel-illi / traefik-auth.conf
Created September 16, 2019 12:19 — forked from DiscoYeti/traefik-auth.conf
Traefik fail2ban
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
@daniel-illi
daniel-illi / youtube-dl
Created September 26, 2018 10:04
dockerized youtube-dl runner
#!/bin/sh
docker run --rm -u 1004:1004 -v "$PWD":/data vimagick/youtube-dl $@
#!/bin/bash
# copied from https://askubuntu.com/questions/892076/how-to-selectively-purge-old-kernels-all-at-once/892077#892077
# NAME: rm-kernels-server
# PATH: /usr/local/bin
# DESC: Provide dialog checklist of kernels to remove
# Non-GUI, text based interface for server distro's.
# DATE: Mar 10, 2017. Modified Aug 5, 2017.
@daniel-illi
daniel-illi / README.md
Created October 6, 2017 11:01 — forked from tristanm/README.md
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@daniel-illi
daniel-illi / gitignore2svnignore.sh
Created April 6, 2017 09:39 — forked from iegik/gitignore2svnignore.sh
Oneliner to convert svn:ignore into .gitignore
#!/bin/bash
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash
@daniel-illi
daniel-illi / HOME_.pry-debundle
Last active February 9, 2017 12:54
pry-byebug without Gemfile entry
# vim: syntax=ruby
# Copyright (c) Conrad Irwin <conrad.irwin@gmail.com> -- MIT License
# Source: https://github.com/ConradIrwin/pry-debundle
#
# To install and use this:
#
# 1. Recommended
# Add 'pry' to your Gemfile (in the development group)
# Add 'pry-debundle' to your Gemfile (in the development group)
#
class Object
def ergo(&b)
if block_given?
b.arity == 1 ? yield(self) : instance_eval(&b)
else
self
end
end
end
@daniel-illi
daniel-illi / truncate.sql
Last active November 2, 2016 09:30
Postgres truncate_tables
CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT schemaname, tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.schemaname) || '.' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
button {
position: absolute;
visibility: hidden;
}
button:before {
content: "goodbye";
visibility: visible;
}