Skip to content

Instantly share code, notes, and snippets.

@ismarsantos
ismarsantos / downloading_pdfs.markdown
Created September 28, 2021 12:57
Generating and Download PDF's in Rails (Windows)

Generating and Downloading PDF's in Rails (Windows)

I had a lot of trouble trying to get one of my Rails apps to accomplish this common task. For one thing, my dev box runs Windows 7, which notoriously does not play nicely with Ruby on Rails. Another thing... all the instructions/tutorials/document for the gem I'm using, Wicked PDF, were either incomplete or, for some reason or another, didn't work for me.

That's all to say, here are the steps I took, and I hope they will help someone.

I used the Wicked PDF gem. Ryan Bates over at RailsCasts goes over using PDFKit, but this writeup will be all about Wicked PDF.

These next steps I got straight from the instructions on the GitHub page:

@ismarsantos
ismarsantos / launch_postgres_console.sh
Created October 23, 2021 14:07 — forked from emailrhoads/launch_postgres_console.sh
Launch Postgres Console #postgres
sudo su -
su postgres
psql
@ismarsantos
ismarsantos / uuidv4test.js
Created October 24, 2021 22:25 — forked from johnelliott/uuidv4test.js
uuid v4 regex
import { v4 as uuid } from 'uuid';
export function generateId() {
return uuid();
}
const v4 = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);
console.log(generateId().match(v4));
//console.log(generateId().length)
@ismarsantos
ismarsantos / generate-ssh-key.sh
Created June 14, 2022 19:01 — forked from denisgolius/generate-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@ismarsantos
ismarsantos / gist:bcd0339314331a80adfcbcf336e1841e
Last active June 18, 2022 03:31
Install Nvidia driver in Ubuntu 20.04
Install nvidia driver
Mar 27, 2022
I had many driver installed I my virtual machine , so It was actually the reason why I was having the error.
To fix it I had first to remove all driver I have installed before using :
sudo apt-get purge nvidia-*
sudo apt-get update
@ismarsantos
ismarsantos / gce-to-gcs-uploads.md
Created July 21, 2022 19:41 — forked from ryderdamen/gce-to-gcs-uploads.md
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@ismarsantos
ismarsantos / nodejs-ubuntu-bind-port-80.md
Created July 27, 2022 15:04 — forked from chairco/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@ismarsantos
ismarsantos / proxmox_nvidia.md
Created August 5, 2022 19:43 — forked from egg82/proxmox_nvidia.md
NVidia Proxmox + LXC

Proxmox

Find the proper driver at the NVidia website.

Note: Make sure to select "Linux 64-bit" as your OS

Hit the "Search" button.

@ismarsantos
ismarsantos / Host
Created August 9, 2022 23:22 — forked from lucndm/Host
Proxmox GPU passthrough to LXC Container
Note : Proxmox 6.1
VI : /etc/apt/sources.list
# security updates
deb http://security.debian.org jessie/updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian jessie pve-no-subscription