Skip to content

Instantly share code, notes, and snippets.

View fradeve's full-sized avatar

Francesco de Virgilio fradeve

View GitHub Profile
@renchap
renchap / README.md
Last active September 24, 2024 14:39
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@acdvorak
acdvorak / tmux-all-panes.sh
Last active August 6, 2021 17:09 — forked from yubink/inall.sh
tmux: run a command in all panes
#!/bin/bash
# Runs the specified command (provided by the first argument) in all tmux panes
# in every window. If an application is currently running in a given pane
# (e.g., vim), it is suspended and then resumed so the command can be run.
all-panes()
{
all-panes-bg_ "$1" &
}
@mariozig
mariozig / migrate_repo.sh
Last active September 16, 2024 18:48
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@bitjockey42
bitjockey42 / mopidy.md
Created April 20, 2014 16:39
An installation and setup guide for mopidy on Arch Linux.

Mopidy on Arch Linux

mopidy

Installation

Install from the AUR.

@urschrei
urschrei / jenks_zero.py
Created September 22, 2013 17:45
Calculate Jenks natural breaks on a dataset containing zero values, using Pandas and Pysal
import pandas as pd
import numpy as np
from pysal.esda.mapclassify import Natural_Breaks as nb
df = pd.DataFrame({'density': np.random.randint(0, 10, 500)})
# replace zero values with NaN
df.replace(to_replace={'density': {0: np.nan}}, inplace=True)
breaks = nb(df[df['density'].notnull()].density.values, k=5)
# this index will allow us to perform the join correctly
@berkes
berkes / hamster2timetrap.rb
Created September 8, 2013 12:02
Quick-n-dirty import of hamster time tracking (https://projecthamster.wordpress.com) into timetrap (https://github.com/samg/timetrap).
require "sqlite3"
hamster = SQLite3::Database.new ".local/share/hamster-applet/hamster.db"
timetrap = SQLite3::Database.new ".timetrap.db"
unparsed = hamster.execute("select * from facts inner join activities on activities.id = facts.activity_id inner join categories on categories.id = activities.category_id")
entries = unparsed.map do |e|
timetrap.execute("insert into entries (note, start, end, sheet) values (?, ?, ?, ?)",
"#{e[6]} #{e[4]}",
@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@pblittle
pblittle / config
Created March 22, 2012 17:45
Vagrant ssh config to ssh/scp from host
Host vagrant
HostName localhost
User vagrant
Port 2210
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
IdentityFile /Users/pblittle/.rvm/gems/ruby-1.9.2-p290@wilbur/gems/vagrant-0.9.7/keys/vagrant
@vjt
vjt / monitor.sh
Created February 23, 2012 17:19
Web server tmux monitoring session
#!/bin/sh
#
# Starts a multiplexed terminal session with tmux running monitoring software.
# Requires dstat, htop and grc. The apache configuration for grc can be found
# here: https://gist.github.com/1885569
#
# My .tmux.conf is here instead: https://gist.github.com/1886016#file_3_tmux.conf
#
# tmux 1.7 or later recommended.
#
@esle
esle / dot.py
Created February 20, 2012 06:08
dot directive for reStructuredText, with this you can write ..dot:: things
"""
dot directive (require graphviz)
"""
from docutils import nodes
from docutils.parsers.rst import directives, Directive
import subprocess as sp
nthUnnamed = 0