Skip to content

Instantly share code, notes, and snippets.

@louisfisch
louisfisch / agnoster.zsh-theme
Created June 18, 2017 16:43
My custom agnoster theme
# vim:ft=zsh ts=2 sw=2 sts=2
# Original Agnoster's theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
# Segment drawing. A few utility functions to make it easy and re-usable to draw segmented prompts
CURRENT_BG='NONE'
# Special Powerline characters
() {
@louisfisch
louisfisch / create-bootable-macos-installer-drive.md
Created September 28, 2016 08:15
How to easily create a bootable macOS Sierra installer drive.

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/VolumeName --applicationpath /Applications/Install\ macOS\ Sierra.

<?php
function dir_to_array($dir_name) {
$files_names = array();
if (is_dir($dir_name)) {
$handle = opendir($dir_name);
while (false !== ($file_name = readdir($handle))) {
$file_path = $dir_name.$file_name;
@louisfisch
louisfisch / readme.md
Last active February 18, 2016 17:46
Some Scilab functions I find useful

Content

  • new_graphic_window() - Checks other existing graphic windows. If so it creates a new graphic window without erasing previous ones.
  • fact(k) - Takes an integer as argument. Returns k!.
  • sumfunction(StartIndex, EndIndex, Fct)- StartIndex and EndIndex are signed integers and Fct is a function (defined with deff() for instance). Let k be an integer then the function sumfunction returns the sum of Fct(k) for k = StartIndex, ..., EndIndex.

Usage

  1. Download the useful-functions.sci file and move it into your project's directory.
  2. Copy and paste the line exec useful-functions.sci at the beginning of your file (after clear; if you use it).
  3. Call any function you need.
@louisfisch
louisfisch / osi-model.md
Last active February 18, 2016 10:37
Tableau résumant le rôle de chaque couche dans le modèle OSI
Position dans le modèle OSI Nom de la couche Rôle de la couche
7 Application Point de contact avec les services réseaux
6 Présentation Présentation des données : format, cryptage, encodage, ...
5 Session Initialisation de la session, de sa gestion et de sa fermeture
4 Transport Choix du protocole de transmission et préparation de l'envoi des données. Elle spécifie le numéro de port utilisé par l'application émettrice ainsi que le numéro de port de l'application réceptrice. Elle fragmente les données en plusieurs séquences (ou segments)
3 Réseau Connexion logique entre les hôtes. Elle traite de tout ce qui concerne l'identification et le routage dans le réseau
2 Liaison de données Éta
@louisfisch
louisfisch / html5-drag-and-drop-events.md
Last active December 20, 2015 13:29
Reminder of HTML5 "drag and drop" API events
Event On Event Handler Description
drag ondrag Fired when an element or text selection is being dragged.
dragend ondragend Fired when a drag operation is being ended (for example, by releasing a mouse button or hitting the escape key).
dragenter ondragenter Fired when a dragged element or text selection enters a valid drop target.
dragexit ondragexit Fired when an element is no longer the drag operation's immediate selection target.
dragleave ondragleave Fired when a dragged element or text selection leaves a valid drop target.
dragover ondragover Fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
dragstart ondragstart Fired when the user starts dragging an element or text selection.
drop ondrop Fired when an element
@louisfisch
louisfisch / pseudo-random-float.swift
Last active February 18, 2016 10:39
Generates random float between 0 and 1
// dependency : import UIKit
Float(Float(arc4random()) / Float(UINT32_MAX))
$VENDORS: webkit, moz, ms, o;
@mixin vendor-prefix($property, $values...) {
@each $vendor in $VENDORS {
-#{$vendor}-#{$property}: $values;
}
#{$property}: $values;
}
@mixin vendor-function($property, $func, $args...) {
function isIntAnyway(x) {
if (Number(x) && x % 1 === 0)
return true;
return false;
}
// Checks if value is in array
function inArray(value, array) {
return array.indexOf(value) > -1;
}