Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Possatti possatti

View GitHub Profile
@possatti
possatti / gpu_names.json
Created Sep 23, 2019
Names of GPUs per hostname. The ID is the pci.bus from nvidia-smi.
View gpu_names.json
{
"lcad55": {
1: "Titan Xp",
},
"car02": {
37: "Titan",
2: "Quadro",
},
"car03": {
37: "Titan",
@possatti
possatti / generate_mame_playlist_for_retroarch.py
Last active Jul 27, 2018
Use a DAT file to scan a ROM folder and create a RetroArch playlist. #MAME
View generate_mame_playlist_for_retroarch.py
#!/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
View cherry_prompt.sh
# 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 Dec 5, 2017
How to install Caffe GPU with Python 3 bindings on Ubuntu 16.04
View Makefile.config
## 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
View Piedown.md

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:

View simonsays
#!/bin/sh
## Simon Says Script
## www.xkcd.com/149
sudo $@
View picturize.js
// 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');
View rot.pl
#!/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 {
View read-stdin.pl
#!/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# }' .
View read-stdin.py
#!/usr/bin/python
import fileinput
for line in fileinput.input():
print "hello" + line