Skip to content

Instantly share code, notes, and snippets.

View guilhermegazzinelli's full-sized avatar

Guilherme Gazzinelli guilhermegazzinelli

View GitHub Profile
Rails.application.eager_load!
exclude_tables = ["sessions"]
row_limit_per_table = nil
tables = []
ApplicationRecord.descendants.each do |model|
next if exclude_tables.any?{ |skip_table| skip_table == model.table_name }
next if tables.include?(model.table_name) # This covers STI
puts "Exporting: #{model.table_name}"
@acristoffers
acristoffers / .vimrc
Last active July 13, 2020 14:45
(Neo)Vim configuration.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" """
""" Álan's NeoVim configuration """
""" """
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
Plug 'ParamagicDev/vim-medic_chalk'
Plug 'SirVer/ultisnips'
@jesster2k10
jesster2k10 / README.md
Last active June 19, 2024 22:56
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 3, 2024 11:22
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@darth-veitcher
darth-veitcher / docker-compose.yaml
Created September 9, 2019 13:26
Traefik v2.0 with Cloudflare Wildcard and OpenVPN
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
command:
# Globals
- "--log.level=DEBUG"
- "--api=true"
@PikachuEXE
PikachuEXE / Dockerfile.app_image
Created September 14, 2018 01:37
2 stage rails app docker image building
FROM user/baseimage:version-tag
# 1. This is VERY basic
# 2. Need to load RVM first during build
# 3. Create empty folders for runtime files
RUN \
rm /bin/sh && ln -s /bin/bash /bin/sh && \
mkdir -p \
/home/app/webapp \
@woudsma
woudsma / portainer-dokku.md
Last active May 7, 2023 23:04
TLS secured TCP exposed Docker daemon on Dokku host - setup

TLS secured TCP exposed Docker daemon on Dokku host - setup

  1. Create certificates
  2. Edit Docker options
  3. Restart Docker
  4. Copy client certificates from host
  5. (optional) Add remote endpoint in Portainer

Tested on a standard $5/mo DigitalOcean VPS running Ubuntu 16.04.


@iffy
iffy / .gitignore
Last active July 1, 2024 07:00
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
#!/bin/bash
#
# Docker Daemon varsayilan olarak ag iletisimi olmadan
# sadece Unix socket uzerinden calismaktadir.
# Docker Client ve Daemon arasinda HTTPS uzerinden
# guvenli iletisimin kurulmasi icin TLS aktif hale getirilmelidir.
# Client ve Server/daemon arasindaki guvenli iletisim agi
# icin gereken client ve server sertifikasyonlarini
# olusturmaliyiz.
#

Host

gst-launch-1.0 -v v4l2src device=/dev/video0
! "image/jpeg,width=1280, height=720,framerate=30/1"
! rtpjpegpay
! udpsink host=$myip port=$myport

Client

gst-launch-1.0 -e -v udpsrc port=$myport !
application/x-rtp, encoding-name=JPEG,payload=26 !
rtpjpegdepay ! jpegdec ! \