Skip to content

Instantly share code, notes, and snippets.

View treyssatvincent's full-sized avatar
👋

Nino treyssatvincent

👋
View GitHub Profile
@treyssatvincent
treyssatvincent / testapi.php
Last active July 4, 2017 09:43
Faire fonctionner l'API sur Congressus ($config["discourse"]["api_key"] à ajouter dans les fichiers de config)
<?php
include_once("header.php");
require_once("engine/discourse/DiscourseAPI.php");
$apiUser = "USERNAME";
$mailUser = "MAIL";
$discourseApi = new richp10\discourseAPI\DiscourseAPI("discourse.partipirate.org", $config["discourse"]["api_key"], "https");
// Tests :
@treyssatvincent
treyssatvincent / csv_to_rb.py
Created June 12, 2017 16:18
convert csv to rb database
import csv
with open('input.csv') as f:
fieldnames = ('tag', 'label', 'description', 'user_id')
r = csv.DictReader(f, fieldnames, delimiter='|')
next(f, None) # skip header
rows = []
k = 0
for row in r:
txt = "Issue.create(tag:'" + row['tag'] + "', label:'" + row['label'] + "', description:'" + row['description'] + "' , user_id:'1')"
with open("output.rb", "a") as output_file:
@treyssatvincent
treyssatvincent / gray.sh
Last active December 28, 2016 14:59
black and white a lot of pictures (jpg, jpeg, png)
clean_extensionjpg(){
mmv \*.[Jj][Pp][Gg] \#1.jpg
mmv \*.[Jj][Pp][Ee][Gg] \#1.jpg
}
clean_extensionpng(){
mmv -v \*.[Pp][Nn][Gg] \#1.png
}
clean_extension(){
clean_extensionpng
clean_extensionjpg