Skip to content

Instantly share code, notes, and snippets.

Avatar

C-Duv

View GitHub Profile
@C-Duv
C-Duv / 0.Notes.md
Created Aug 1, 2017
Example for Docker Swarm, Let's Encrypt and Nginx setup with no Nginx down time (answer to https://twitter.com/developius/status/892470102632923136)
View 0.Notes.md
@C-Duv
C-Duv / commands.sh
Last active Feb 12, 2020
Commands to build ipxe files via Docker (using a Debian 10.2 image)
View commands.sh
# Path where to work
IPXE_DIRPATH="/opt/ipxe"
# Create some directories
mkdir -p "${IPXE_DIRPATH}/"{ipxe_project,builder}
# Fetch iPXE source files
cd "${IPXE_DIRPATH}/ipxe_project"
git clone https://github.com/ipxe/ipxe.git .
@C-Duv
C-Duv / README.md
Last active Dec 19, 2019
Mongoose - Trying to determine collection and operation inside hook for insert/update/delete queries
View README.md

This gist is to help me find a way to determine the updated collection and the operation (document insertion, update or removal) from inside a Mongoose hook.

How to run

  1. git clone this gist
  2. Run npm install
  3. Execute with node app.js
@C-Duv
C-Duv / steamdb-bookmarklet.js
Created Jun 10, 2019
Bookmarklet to open Steam Database (steamdb.info) page from Steam Store (store.steampowered.com) page
View steamdb-bookmarklet.js
/**
How to use:
1/ Use the following line as the "URL" of a bookmark in your web browser.
2/ Place the bookmark in the bookmark bar for easy access.
3/ When on a steampowered.com page, click on the bookmark and the corresponding steamdb.info page will open.
*/
javascript:(function(){if (window.location.hostname == 'store.steampowered.com') {var pathMatch = window.location.pathname.match(/^\/(?<appType>(app|bundle|sub))\/(?<appId>\d+)\//);pathMatch && window.open('https://steamdb.info/' + pathMatch.groups.appType + '/' + pathMatch.groups.appId + '/?source=bookmarklet','_blank');}})();
View mongoose-debug_pre_post_hooks_order-reproduction-code.js
const { MongoMemoryServer } = require('mongodb-memory-server');
const mongoose = require('mongoose');
const mongoServer = new MongoMemoryServer({
'instance': {
'dbName': 'temp',
'port': 35555,
}
});
@C-Duv
C-Duv / mongoose-gh7608-pass_data_from_debug_to_post_hook.js
Created Mar 14, 2019
Mongoose - GH7608: Pass data from debug to post hook
View mongoose-gh7608-pass_data_from_debug_to_post_hook.js
const { MongoMemoryServer } = require('mongodb-memory-server');
const mongoose = require('mongoose');
const mongoServer = new MongoMemoryServer({
'instance': {
'dbName': 'temp',
'port': 35555,
}
});
@C-Duv
C-Duv / script_device_MPD_Radio.lua
Last active Dec 9, 2017
A LUA script for Domoticz that controls an MPD server volume (via `mpc` client) under the orders of a dummy Domoticz dimmer
View script_device_MPD_Radio.lua
--
-- LUA script for Domoticz that controls an MPD server (via `mpc` client) under
-- the orders of a dummy Domoticz dimmer device.
--
-- No configuration required on the device, the LUA script listen to order such
-- as "Set Level: 42 %" and sends adequate `mpc volume` commands.
--
commandArray = {}
-- Name of the dummy Domoticz dimmer:
@C-Duv
C-Duv / LibreofficeCalc-KiB-to-UpperBinaryPrefixes
Created Dec 13, 2013
Pour LibreOffice Calc : Convertir des Kio en Kio, Mio, Gio, Tio tout en affichant l'unité. Notes : * Dans l'exemple, les Kio sont contenu dans la cellule A1 * Un arrondi est effectué (peut être retiré sans impact autre que visuel)
View LibreofficeCalc-KiB-to-UpperBinaryPrefixes
=SI(
A1/1024>=1;
SI(
A1/1024/1024>=1;
SI(
A1/1024/1024/1024>=1;
CONCATENER(ARRONDI(A1/1024/1024/1024;3);" Tio");
CONCATENER(ARRONDI(A1/1024/1024;3);" Gio")
);
CONCATENER(ARRONDI(A1/1024;3);" Mio")
View Exception.php.patch
--- Zend Framework 1.12.1/library/Zend/Session/Exception.php Thu Jan 05 21:35:02 2012
+++ Zend Framework - Fixed/library/Zend/Session/Exception.php Thu Jan 03 03:17:37 2013
@@ -55,7 +55,9 @@
*/
static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext)
{
- self::$sessionStartError = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr;
+ if (error_reporting() !== 0) {
+ self::$sessionStartError = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr;
+ }
@C-Duv
C-Duv / IndexController.php
Created Jan 3, 2013
Reproduction code for ZF-12494 (http://framework.zend.com/issues/browse/ZF-12494): A class implementing __wakeup() and a controller using it.
View IndexController.php
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
switch ($this->_getParam('what', 'test')) {
case 'store': $this->_store(); break;
case 'retrieve': $this->_retrieve(); break;
case 'clear': $this->_clear(); break;
You can’t perform that action at this time.