Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
def get_field(instance, field): | |
field_path = field.split('.') | |
attr = instance | |
for elem in field_path: | |
try: | |
attr = getattr(attr, elem) | |
except AttributeError: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install tmux 3.0a on Centos | |
# install deps | |
sudo yum install -y gcc kernel-devel make ncurses-devel | |
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz | |
tar -xf libevent-2.1.11-stable.tar.gz | |
cd libevent-2.1.11-stable | |
./configure --prefix=/usr/local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Original (by yahvuu): http://www.gimpusers.com/forums/gimp-developer/11718-autosave-plugin | |
import tempfile, os | |
from time import * | |
from gimpfu import * | |
def autosave(image, layer): | |
backupInterval = 10 * 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gera a paginação dos itens de um array ou collection. | |
* | |
* @param array|Collection $items | |
* @param int $perPage | |
* @param int $page | |
* @param array $options | |
* | |
* @return LengthAwarePaginator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb help // List all comands | |
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Some utils for paper writing | |
% Just add this file to your project folder and \input{writing_utils} in the main tex file | |
\usepackage{color} | |
\usepackage{background} | |
% During writing | |
\newcommand{\todo}[1]{{\color{orange} #1}} | |
\newcommand{\unsure}[2]{{\color{magenta} #1 }{\color{gray} #2}} % check information, move it, etc. | |
\newcommand{\highlight}[1]{\textbf{#1}} % Highlight important phrases, check if they are prominent enough |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/openrc-run | |
description="Start minecraft server" | |
command_user="minecraft:minecraft" | |
command="/usr/bin/java" | |
command_args="-Xmx1024M -Xms1024M -jar server.jar nogui" | |
pidfile=mine.pid | |
command_background=true | |
directory="/home/minecraft" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%PDF-1.0 | |
1 0 obj | |
<< | |
/Type /Catalog | |
/Pages 2 0 R | |
/Names 6 0 R | |
>> | |
endobj |
NewerOlder