Skip to content

Instantly share code, notes, and snippets.

View epistrephein's full-sized avatar

Tommaso Barbato epistrephein

View GitHub Profile
#!/bin/bash
OLDIFS=$IFS
export IFS=$'\n'
# Find all boxes which have updates
AVAILABLE_UPDATES=$(vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2 2>/dev/null)
if [[ ${#AVAILABLE_UPDATES[@]} -ne 0 ]]; then
@chezou
chezou / Gemfile
Last active May 11, 2019 16:35
Example code of ruby with Amazon Polly
source 'https://rubygems.org'
gem 'nokogiri', '~>1.6'
gem 'aws-sdk', '~> 2'
@MyklClason
MyklClason / Gemfile.rb
Last active June 5, 2019 20:35
Search/Sort/Paginate with Ransack and Kaminari
...
gem 'kaminari'
gem 'ransack'
..
@blueset
blueset / README.md
Last active October 21, 2022 02:56
Download/Print StuDocu.com documents without watermark

Usage

Add StuDocu Extracter to your Browser favorites, and click on it after you open the StuDocu document.

How it works

javascript:(function(){var a = "", x = document.getElementsByTagName("svg"); for(var i = 0; i < x.length; i++){a += x[i].outerHTML;} document.getElementsByTagName("body")[0].innerHTML = a;var a = document.getElementsByTagName("svg");for (var i = 0; i < a.length; i++){a[i].style.width="99.8%";a[i].style.height="auto";a[i].style.position="inherit";a[i].style.display="block";a[i].style.boxShadow="0 3px 3px rgba(0,0,0,0.3)";a
@burke
burke / genkey.rb
Created October 12, 2016 14:34
Create an Elliptic Curve keypair in ruby
require 'openssl'
k = OpenSSL::PKey::EC.new('secp384r1').generate_key
p = OpenSSL::PKey::EC.new(k.public_key.group)
p.public_key = k.public_key
puts k.to_pem, p.to_pem
@arteezy
arteezy / puma.service
Last active May 9, 2024 22:22
Manage Puma with systemd and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@AlexMax
AlexMax / retroarch.md
Last active March 21, 2024 20:10
Setting up RetroArch on a Raspberry Pi

Setting up RetroArch on a Raspberry Pi

I just put the finishing touches on my Raspberry Pi 3 emulation machine running RetroArch. I was not a huge fan of RetroPie due to the reliance on Emulation Station - more moving parts meant that there were more things that could potentially break. I just wanted something that would run raw RetroArch, no frills.

This tutorial is mostly recreated from memory and was most recently tested with a Raspberry Pi 3 running Raspbian Stretch and RetroArch 1.7.7. If there is a mistake or a broken link, PLEASE message me and I will fix it.

Step 1: Install Raspbian

I used Raspbian Stretch Lite from this page. Write the image to your SD card using something like Win32 Disk Imager, or if you're using OSX/Linux follow a tutorial on how to write the image using dd.

@rennex
rennex / foo.service
Last active July 18, 2023 11:34
Example of a systemd service file to start a Sinatra app.
# /etc/systemd/system/foo.service
[Unit]
Description=Foo service
Wants=nginx.service
Requires=postgresql.service
After=postgresql.service
[Service]
Type=simple
User=foo
@lachesis
lachesis / letsencrypt_notes.sh
Last active December 13, 2023 11:02
Set up LetsEncrypt using acme.sh without root
# How to use "acme.sh" to set up Lets Encrypt without root permissions
# See https://github.com/Neilpang/acme.sh for more
# This assumes that your website has a webroot at "/var/www/<domain>"
# I'll use the domain "EXAMPLE.com" as an example
# When this is done, there will be an "acme" user that handles issuing,
# updating, and installing certificates. This account will have the following
# (fairly minimal) permissions:
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge
#!/bin/sh
PRINT=true
LOGGER=false
warning_days=30
certs_to_check='example.com:443
mail.example.com:25
wiki.example.org:443
'