Skip to content

Instantly share code, notes, and snippets.

View antoineMoPa's full-sized avatar

Antoine M-P antoineMoPa

  • Sherbrooke, Québec, Canada
View GitHub Profile
@antoineMoPa
antoineMoPa / count-ip.py
Created March 12, 2015 00:21
Count the number of times every IP was found in apache log files
# Counts the number of times an IP was found in all the .log files in the folder
# first argument : log file name
# second argument : minimum number of error to print an ip
import sys
import os
import re
def extract_ips():
os.system('echo "" > all.data')
# Pixel sorts an image
# Takes 2 arguments:
# $1 is the original filename
# $2 is the field to order:
# 1 r
# 2 g
# 3 b
# 4 r + g + b
# Takes 2 arguments:
# $1 is the original filename
# $2 is the field to order:
# 1 r
# 2 g
# 3 b
# 4 r + g + b
# Example:
# sh sort.sh me.jpg 4
@antoineMoPa
antoineMoPa / gnucap-gnuplot-basics.md
Created December 8, 2015 02:03
Gnucap + Gnuplot

gnucap file:

* Hello :D this is a file created to be read by gnucap in batch mode

* circuit definition (netlist)
R1 0 1 100k
* This one has an initial voltage
C1 1 2 680n IC=12
L1 2 0 20m
/*
Met les notes en pourcentages dans la grille d'évaluation de www.gel.usherbrooke.ca
UTILISATION: Il faut ouvrir la page de l'horaire (dans un nouvel onglet) et faire rouler le code dans la console javascript.
Copyright Antoine Morin-Paulhus 2015
Vous pouvez utiliser, modifier et distribuer ce script sous les termes de la license GPL disponible ici:
http://www.gnu.org/licenses/gpl-3.0.en.html
*/
@antoineMoPa
antoineMoPa / gist:5277081
Created March 30, 2013 15:21
Small app menu for X that launches user defined commands. I created it when I used 9wm. I wanted a lightweight application launcher. This code can be useful to people who wonder how to create X applications without any widget library such as GTK or QT.
// main.c
//
// Copyright 2012 Antoine Morin-Paulhus <antoine.morin.paulhus@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
@antoineMoPa
antoineMoPa / latex-tikz-example.tex
Created December 15, 2015 22:56
Basics of tikz (lines, plots, grids)
\section{Example drawings with tikz}
% cremeronline.com/LaTeX/minimaltikz.pdf
% You have to \usepackage{tikz}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (2,4);
\draw (0,1) --(1,3.666) --(2,1) -- (2,0) --(0,0) -- (0,1);
\draw [->] (3.5,0.5) -- (6,0.5);
\draw [|->] (3.5,1) -- (6,1);
@antoineMoPa
antoineMoPa / shortcutLib.js
Last active December 20, 2015 14:49
Small javascript library that does most of the things I need from jQuery
var shortcutLib;
if(typeof q !== 'undefined'){
shortcutLib.previousQ = q;
}
(function(q){
var rootElement = document;
var treecan = document.querySelectorAll("canvas")[0];
var w = treecan.width = 1920;
var h = treecan.height = 1080;
var interval = null;
delay = 30
var ctx = can.getContext("2d");
ctx.fillStyle = "#FFFFFF";
ctx.fillRect(0,0,w,h);
@antoineMoPa
antoineMoPa / .emacs-part
Created February 26, 2016 19:34
Start eshell when starting emacs
(eshell)
(split-window-right)
(switch-to-buffer "*eshell*")