Skip to content

Instantly share code, notes, and snippets.

@demaisj
demaisj / checkbox_checked_state.php
Last active December 21, 2015 15:38
PHP : Check if checkbox is checked
<?php
// <input type="checkbox" name="checkbox" value="1" />
$checked = isset($_GET['checkbox']) && $_GET['checkbox'] ? true : false;
@demaisj
demaisj / improved_native_for_loop.php
Created September 3, 2013 10:00
PHP : Improved native for loop variations for much speed when iterating
<?php
$array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
for($i = count($array)-1;$i >= 0; $i--) {
echo $array[$i].", ";
};
/* Will produce :
10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
@demaisj
demaisj / build_get_url.php
Created August 1, 2014 12:46
Builds an URL with GET params in PHP
<?php
/**
* Build an URL with GET params
* @param string $url The URL
* @param array $params The GET params to append to the url
* @return string The new builded URL
*/
function build_get_url($url, $params){
$index = 0;
@demaisj
demaisj / batcheck.sh
Created December 4, 2016 15:31
Low Battery Alert
#!/bin/bash
#
# TO BE RUN EACH 5 MINUTES
#
BATTERY="/sys/class/power_supply/BAT0"
CRITICAL=10
ICON="battery-caution"
NOT_CHARGING="Discharging"
@demaisj
demaisj / README.md
Last active November 8, 2020 17:38
BLINUX 4.0 EL TIGRE - Virtual Machine How-To

#Steps

  1. Download openSUSE Tumbleweed x86_64 ISO https://en.opensuse.org/openSUSE:Tumbleweed_installation
  2. Download every latest .rpm here, except exam ones https://pkg.blinux.fr/blinux/el_tigre/noarch/
  3. Boot onto the openSUSE ISO && install it
    • do a classic install
    • skip user creation
    • select server/text mode
  4. Once openSUSE installed, get the .rpm fileson the vm disk (use ssh, wget, or curl...)
  5. Add the BLINUX repository to zypper using zypper ar -p 150 https://pkg.blinux.fr/opensuse/update/13.2/openSUSE:13.2:Update.repo
@demaisj
demaisj / install_qcm_ci.sh
Last active March 15, 2017 14:17 — forked from lodi-g/install_qcm_ci.sh
Install script for a private repository
#!/bin/bash
QCM_CI_FOLDER="/mnt/home/exam/QCM-CI/"
function error {
echo
echo "Failed. Exiting."
if [ -z $1 ]; then
echo "Umounting /mnt."
umount /mnt
@demaisj
demaisj / zarbouka.user.js
Created March 6, 2017 01:35
GREGOIRE LODI POINT JAVASCRIPT
// ==UserScript==
// @name zarbouka
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://intra.epitech.eu/user/gregoire.lodi@epitech.eu/
// @grant unsafeWindow
// ==/UserScript==
@demaisj
demaisj / yt-thumb-preview.user.js
Last active January 21, 2018 12:33
Previews a YouTube video when hovering a thumnail on YouTube
// ==UserScript==
// @name Youtube Video Preview
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *.youtube.com/*
// @grant none
// ==/UserScript==
@demaisj
demaisj / precision.user.js
Created March 20, 2017 01:11
Precision Salement Unique
// ==UserScript==
// @name Precision Salement Unique
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://intra.epitech.eu/*PSU*
// @grant unsafeWindow
// ==/UserScript==