Skip to content

Instantly share code, notes, and snippets.

View mseri's full-sized avatar
👻
Always with you with the MTGAP 2.0 keyboard layout

Marcello Seri mseri

👻
Always with you with the MTGAP 2.0 keyboard layout
View GitHub Profile
@mseri
mseri / update-ghost.sh
Last active December 25, 2015 23:49
A small bash script to update ghost. It assumes that your ghost blog is installed in a subfolder called ghost and you are running it from the parent folder. Moreover it assumes that you use forever to manage your ghost server and that you run it from a script called starter.sh
#!/bin/bash
if [[ -z $GHOSTUPDATEFILE ]];
then
export GHOSTUPDATEFILE='ghost-0.4.0.zip'
fi
if [[ -z $GHOSTUPDATELOCATION ]];
then
export GHOSTUPDATELOCATION='update-ghost'
@mseri
mseri / gist:7779369
Created December 3, 2013 23:10
Anchor post-install .htaccess
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history
import sys
def main():
@mseri
mseri / prompt_mseri_setup
Last active December 31, 2015 18:29
My custom zsh theme, to be used with prezto (https://github.com/sorin-ionescu/prezto). It is a modified version of [https://github.com/skwp/dotfiles/blob/master/zsh/prezto-themes/prompt_steeef_simplified_setup](YADR steeef simplified)
#
# A theme based on Steve Losh's Extravagant Prompt with vcs_info integration.
#
# Authors:
# Marcello Seri <mseri@mseri.me>
# Steve Losh <steve@stevelosh.com>
# Bart Trojanowski <bart@jukie.net>
# Brian Carper <brian@carper.ca>
# mseri <mseri@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
@mseri
mseri / fixrust.sh
Last active August 29, 2015 14:16
Fixes dyld libraries path to be able to install rust in /opt/local
#!/usr/bin/env bash
set -euo pipefail
#IFS=$'\n\t'
E_BADARGS=85
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hash"
exit $E_BADARGS
@mseri
mseri / pixellize.py
Last active August 29, 2015 14:19
Pixellizer :)
#!/usr/bin/env python3
"""Pixellize
Generate a "pixellated" copy of IMAGEFILE.
Usage:
pixellize.py [--length=L] [--pixels=P] IMAGEFILE
pixellize.py -h | --help
Options:
-h --help Show this screen.
@mseri
mseri / get_ghost_articles.py
Created May 16, 2015 23:12
Takes a Ghost (www.ghost.org) json datafile and fills the folder with markdown posts.
"""Takes a Ghost json datafile and fills the folder with markdown posts.
It does not import the tags (yet)."""
import json
AUTHOR = "My Name"
GHOST_DATAFILE = "ghostData.json"
ARTICLE_FOLDER = "" # An empty string corresponds to the script folder
def slugify(value):
"""
@mseri
mseri / publish_blog.sh
Last active August 29, 2015 14:21
Pelican blog publish script
#!/usr/bin/env bash
#set -euf -o pipefail
set -ef -o pipefail
echo "Activate Virtual Environment"
source venv/bin/activate
echo "Generate website"
cd struct
pelican content -o output -s publishconf.py
@mseri
mseri / bup.rb
Created May 28, 2015 10:59
Trivial backup system
#!/usr/bin/env ruby
require 'find'
require 'digest/sha1'
require 'fileutils'
#
# input: file = "/full/path/to/file"
# output: sha1 hash hexdigest of the file
# e.g 7d99a42960fa0f1e67ca7d00f99a279f1c8bfd07
#
@mseri
mseri / lasmailer.py
Last active August 29, 2015 14:22
LAS Mailer
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""Generate emails for the London Analysis Seminar ML and saves them on GMail Drafts."""
# TODO: Implement send the mail to the mailing-list
#import smtplib
try:
from colorama import Fore, init