Skip to content

Instantly share code, notes, and snippets.

🐑
S H E E P

Nathanael Demacon quantumsheep

🐑
S H E E P
Block or report user

Report or block quantumsheep

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
@quantumsheep
quantumsheep / vodeclic-bot.user.js
Last active Apr 18, 2019
TamperMonkey Vodeclic Bot
View vodeclic-bot.user.js
// ==UserScript==
// @name Vodeclic bot
// @version 0.5
// @description Bot for vodeclic
// @author QuantumSheep
// @include *://*.vodeclic.com/*/formation/*
// @include *://*.vodeclic.com/*/course/*
// ==/UserScript==
(function() {
@quantumsheep
quantumsheep / setscreen.sh
Created Feb 7, 2019
Add 1920x1080 resolution with xrandr in VMWare (Virtual1 monitor)
View setscreen.sh
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080
xrandr --output Virtual1 --mode 1920x1080
@quantumsheep
quantumsheep / flen.c
Created Dec 6, 2018
Calculate a file length. The file need to be in `rb` mode (reading and binary mode)
View flen.c
#include <stdio.h>
int flen(FILE *f)
{
int len;
int origin = ftell(f);
fseek(f, 0, SEEK_END);
len = ftell(f);
View range.js
/**
* @param {number} start
* @param {number} end
* @returns {number[]}
*/
function range(start, end) {
if (start > end) return [];
return [...Array(end - start + 1).keys()].map(i => i + start);
}
View keybase.md

Keybase proof

I hereby claim:

  • I am quantumsheep on github.
  • I am quantumsheep (https://keybase.io/quantumsheep) on keybase.
  • I have a public key ASDhoA1jmGOWPj7gwYyIqMaNDsM9zFgl2GqhdfEP89xEEQo

To claim this, I am signing this object:

@quantumsheep
quantumsheep / progress_bar.js
Created Nov 14, 2018
Progress bar generator function
View progress_bar.js
/**
*
* @param {number} percents / 100
* @param {number} length
* @param {object} phases
* @param {string} phases.filled
* @param {string} phases.empty
* @param {string} phases.partial
*/
function progress_bar(percents, length = 10, phases = { filled: '', empty: '', partial: '' }) {
@quantumsheep
quantumsheep / walk.js
Created Oct 15, 2018 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
View walk.js
// List all files in a directory in Node.js recursively in an asynchronous fashion
const fs = require('fs').promises;
const path = require('path');
const walk = async (dir, filelist = []) => {
const files = await fs.readdir(dir);
for (file of files) {
const filepath = path.join(dir, file);
const stat = await fs.stat(filepath);
@quantumsheep
quantumsheep / arraynde.h
Last active Oct 16, 2017
C utils functions tu use an array in loop
View arraynde.h
void array_fill_empty(char **array, int max_elements) {
int i;
for(i = 0; i < max_elements; i++) {
array[i] = 0;
}
}
void array_fill(char **array, int max_elements, char toFill) {
int i;
@quantumsheep
quantumsheep / app.js
Last active Aug 28, 2017
Summernote - OnImageUpload: Place image in editor if size is under 1Mo
View app.js
$('#summernote').summernote({
callbacks: {
onImageUpload: function(image) {
if((image[0].size/1024/1024) > 1) {
alert("Merci de déposer une image inférieure à 1 Mo, sinon uploadez-là sur un site d'hébergement d'image ou sur PETERPAN et utilisez la fonction image.");
return false;
} else {
var file = image[0];
var reader = new FileReader();
reader.onloadend = function() {
You can’t perform that action at this time.