Skip to content

Instantly share code, notes, and snippets.

View possatti's full-sized avatar

Lucas Possatti possatti

View GitHub Profile
@possatti
possatti / gpu_names.json
Created September 23, 2019 05:09
Names of GPUs per hostname. The ID is the pci.bus from nvidia-smi.
{
"lcad55": {
1: "Titan Xp",
},
"car02": {
37: "Titan",
2: "Quadro",
},
"car03": {
37: "Titan",
@possatti
possatti / generate_mame_playlist_for_retroarch.py
Last active July 27, 2018 20:17
Use a DAT file to scan a ROM folder and create a RetroArch playlist. #MAME
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import xml.etree.ElementTree as ET
import argparse
import sys
import os
# Palette: http://colorpalettes.net/color-palette-3697/
# Brown: #4f231c rgb(79,35,28)
# Dark red: #88011d rgb(136,1,29)
# Light red: #da002b rgb(218,0,43)
# Blueish: #8ed2df rgb(142,210,223)
# Kinda white: #f2efdf rgb(242,239,223)
# Alternative pallete: http://colorpalettes.net/tag/the-color-of-cherry/
# Green 1: #7e9b0d rgb(126,155,13)
# Green 2: #baaf07 rgb(186,175,7)
@possatti
possatti / Makefile.config
Last active December 5, 2017 18:50
How to install Caffe GPU with Python 3 bindings on Ubuntu 16.04
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers

Piedown

Piedown is a small python script that converts Markdown text to HTML using only regular expressions. It was much inspired by jbroadway's Slimdown.

Usage

To convert a page.md file written in Markdown to a page.html file, use:

#!/bin/sh
## Simon Says Script
## www.xkcd.com/149
sudo $@
// PhantomJS script for rendering a page to an image.
// Author: Lucas Possatti
// Require system to get the command line arguments.
var system = require('system');
// Verify if the program received the proper arguments. And warns the user
// if necessary.
if (system.args.length != 3) {
console.log('Usage: phantomjs picturize.js page_url image_path');
@possatti
possatti / rot.pl
Last active August 29, 2015 14:04
#!/usr/bin/perl
## Example from http://langref.org/all-languages/strings/reversing-a-string/simple-substitution-cipher
sub rot13 {
my $str = shift;
$str =~ tr/A-Za-z/N-ZA-Mn-za-m/;
return $str;
}
sub rot47 {
#!/usr/bin/perl
while(<STDIN>){ # Puts each line at $_ , which can be used in the loop.
chomp; #Implicitly uses $_, if no parameter is specified.
print "hello $_\n"; # Uses $_ explicitly in a string.
}
## It is possible to do a fast little trick on the command line:
# perl -pe '#Transform $_#'
## -n : surround you code with 'while (<>) { #your code# }' .
#!/usr/bin/python
import fileinput
for line in fileinput.input():
print "hello" + line