Skip to content

Instantly share code, notes, and snippets.

Samuel FORESTIER HorlogeSkynet

Block or report user

Report or block HorlogeSkynet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@HorlogeSkynet
HorlogeSkynet / update_gitea.sh
Last active Apr 13, 2019
Gitea automatic update script from binary for Linux
View update_gitea.sh
#!/usr/bin/env bash
: "
1. Copy this script as '~/update_gitea.sh'
2. Now make it executable with 'chmod +x update_gitea.sh'
3. Set the constants below to fit your Gitea setup
"
VERSION="1.7.1"
ARCH="amd64"
@HorlogeSkynet
HorlogeSkynet / TeraStation_Shutdown.py
Last active Mar 2, 2019
A Python script to programmatically shutdown Buffalo TeraStation NAS not proposing any API
View TeraStation_Shutdown.py
#!/usr/bin/env python3
# Installation : `pip3 install requests`
import re
import requests
import ssl
import sys
import urllib3
@HorlogeSkynet
HorlogeSkynet / remove_proxmox_subscription_message.sh
Created Oct 3, 2018
How to remove Proxmox 5.X subscription message ?
View remove_proxmox_subscription_message.sh
#!/usr/bin/env bash
sed -i.bak 's/NotFound/Active/1' /usr/share/perl5/PVE/API2/Subscription.pm
systemctl restart pveproxy.service
exit 0
@HorlogeSkynet
HorlogeSkynet / test_flask_v1.py
Created Aug 24, 2018
Flask v1.X testing example with UNITTEST Python module only
View test_flask_v1.py
"""Flask v1.x testing class working with UNITTEST Python module."""
# Run this module with :
# `python3 -m unittest test_flask_v1.py`
import os
import tempfile
import unittest
# Import your production module using Flask around here.
@HorlogeSkynet
HorlogeSkynet / docker-compose.yml
Created Aug 21, 2018
How to start application container only once MongoDB has finished warming up, running with Docker
View docker-compose.yml
version: '2.3'
services:
application:
build: .
depends_on:
database:
condition: service_healthy
@HorlogeSkynet
HorlogeSkynet / generate_html.php
Created Jun 21, 2018
How to generate a HTML rendered file as of CakePHP 3 ?
View generate_html.php
<?php
use Cake\Filesystem\File;
use Cake\View\View;
/* ... */
// Instanciates a new View class.
$view = new View();
@HorlogeSkynet
HorlogeSkynet / ResetMock.py
Last active Feb 17, 2019
How to reset a mocked object during test in Python 3 ?
View ResetMock.py
#!/usr/bin/env python3
import unittest
from subprocess import check_output
from unittest.mock import patch
class YourClass(object):
def __init__(self):
@HorlogeSkynet
HorlogeSkynet / PopenMock.py
Last active Feb 17, 2019
How to mock stdout runtime attribute of subprocess.Popen call in Python 3 ?
View PopenMock.py
#!/usr/bin/env python3
import os
import tempfile
import unittest
from subprocess import PIPE, Popen, check_output
from unittest.mock import patch
@HorlogeSkynet
HorlogeSkynet / clean_pip_packages.sh
Last active Feb 4, 2018
A simple command line to uninstall each PIP package installed by a regular user
View clean_pip_packages.sh
#!/bin/bash
pip3 freeze --user | xargs pip3 uninstall -y
@HorlogeSkynet
HorlogeSkynet / Crocker's_Rule.md
Created Jan 29, 2018
Simple GitHub Gist for the Crocker's Rules (http://sl4.org/crocker.html)
View Crocker's_Rule.md

Declaring yourself to be operating by "Crocker's Rules" means that other people are allowed to optimize their messages for information, not for being nice to you. Crocker's Rules means that you have accepted full responsibility for the operation of your own mind - if you're offended, it's your fault. Anyone is allowed to call you a moron and claim to be doing you a favor. (Which, in point of fact, they would be. One of the big problems with this culture is that everyone's afraid to tell you you're wrong, or they think they have to dance around it.) Two people using Crocker's Rules should be able to communicate all relevant information in the minimum amount of time, without paraphrasing or social formatting. Obviously, don't declare yourself to be operating by Crocker's Rules unless you have that kind of mental discipline.

Note that Crocker's Rules does not mean you can insult people; it means that other people don't have to worry about whether they are insulting you. Crocker's Rules are a dis

You can’t perform that action at this time.