Skip to content

Instantly share code, notes, and snippets.

View chaves's full-sized avatar

Bruno Chaves Ferreira chaves

View GitHub Profile
@chaves
chaves / regexFouleurs.py
Created November 20, 2018 10:32
Expressions régulières pour le projets les fouleurs
import pickle
import re
import pandas as pd
df = pickle.load( open( "df_info.pickle", "rb" ) )
findID = re.compile(r"Identifiant: #(.+?(?=;))")
findTitre = re.compile(r"Titre: (.+?(?=;))")
findCat = re.compile(r"Cat.?gorie: (.+?(?=;))")
findTemps = re.compile(r"Temps par t.?che: (.+?(?=;))")
# Memory + CPU
cat /proc/meminfo
cat /proc/cpuinfo
# Add new user
sudo useradd -m -s /bin/bash XXXX
sudo passwd XXXX # set password
sudo chage -d 0 XXXX # force password change
# Install Miniconda
@chaves
chaves / git.config
Created December 9, 2017 15:22
git configs
git config --global alias.hist 'log --oneline --graph --decorate --all'
@chaves
chaves / duplicate.sql
Last active November 29, 2017 13:41
duplicate row
# https://stackoverflow.com/questions/729489/duplicate-copy-records-in-the-same-mysql-table
CREATE TEMPORARY TABLE tmp SELECT * FROM calls WHERE id = 16;
UPDATE tmp SET slug='' WHERE id = 16;
UPDATE tmp SET id=35 WHERE id = 16;
INSERT INTO calls SELECT * FROM tmp WHERE id = 35;
---
CREATE TEMPORARY TABLE tmp SELECT * FROM call_participants WHERE id = 13;
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {