Skip to content

Instantly share code, notes, and snippets.

View allencch's full-sized avatar

Allen allencch

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
probonopd /
Last active June 12, 2024 22:16
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

jesster2k10 /
Last active June 3, 2024 10:12
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:

liuxd /
Created April 4, 2019 02:57
[Connecting DBeaver to a Heroku Postgres Database] #PostgreSQL #Heroku

To connect Pgsql in Heroku, SSL is required. If not, an error message will be given:

FATAL: no pg_hba.conf entry for host "", user "rphbqggxeokuxl", database "dc008iqk0rq4j5", SSL off

To make it with DBeaver:

  • click the "SSL" tab on connection proper.
  • choose a Factory for "SSL Factory" in the "Advanced" section.
AshikNesin / base64-form-data.js
Last active December 19, 2023 06:08
Base64 image to multipart/form-data
const base64 = 'data:image/png;base64,....' // Place your base64 url here.
.then(res => res.blob())
.then(blob => {
const fd = new FormData();
const file = new File([blob], "filename.jpeg");
fd.append('image', file)
// Let's upload the file
// Don't set contentType manually →
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04
Last active March 8, 2024 17:34
Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

plindberg /
Created August 5, 2017 16:46
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.


Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.
joyrexus /
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?


yes, even hidden code blocks!

print("hello world!")
wbotelhos /
Last active April 2, 2024 10:04
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
# 2. Clear scheduled jobs
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
this.state ={