Skip to content

Instantly share code, notes, and snippets.

@rigwild
rigwild / ytdl-core-server.js
Last active July 5, 2018 12:15
Get MP4/OGG download links from Youtube videos. A little ytdl-core server implementation (https://github.com/fent/node-ytdl-core).
const http = require('http');
const ytdl = require('ytdl-core');
const getInfo = async youtubeUrl => {
const data = await ytdl.getInfo(youtubeUrl);
let result = {
id: data.video_id,
url: data.video_url,
title: data.title,
description: data.description,
@rigwild
rigwild / create_web_project.js
Last active July 10, 2018 15:33
Quickly create a web project with node.
/*
## Usage :
node create_web_project.js projectName
*/
'use strict'
const fs = require('fs')
if (process.argv.length <= 2) {
@rigwild
rigwild / loginCookie.php
Last active August 15, 2018 16:28
A PHP secure login cookie system
<?php
$connexion = new PDO('mysql:host=' . $host . ';port=' . $port . ';dbname=' . $dbname, $user, $pass);
$connexion->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Cookie session validity duration (Default = 2 weeks)
$cookieSessionTimeout = 3600 * 24 * 14;
function createLoginCookie()
{
@rigwild
rigwild / pass-acme-challenge.sh
Created August 31, 2018 12:25
Quickly validate a ACME Challenge for SSL certs validation
mkdir .well-known .well-known/acme-challenge
php -S www.your.domain.to.validate.com:80
# Simply set a DNS A pointing to the server's IP and use this to pass the ACME Challenge
# to validate your SSL certificates.
[{"lineName":"1","lineData":{"direction1":[{"station":"ROND POINT D'OYE","schedule":{"weekDays":["06:50","07:06","07:50","08:29","08:45","09:18","09:55","10:30","11:06","11:43","12:20","12:58","13:33","14:07","14:37","15:10","15:40","16:14","16:45","17:17","17:48","18:16","18:51","19:22","19:45","19:56"]}},{"station":"AERODROME","schedule":{"weekDays":["07:03*","07:33","08:11","08:58","09:34","10:12","10:46","11:22","11:58","12:37","13:10","13:47","14:22","14:50","15:22","15:54","16:28","16:58","17:30","18:02","18:28","19:03","19:30","20:00","20:08"]}},{"station":"MAIRIE DE MARCK","schedule":{"weekDays":["07:05*","07:35","08:13","09:00","09:36","10:14","10:48","11:24","12:00","12:39","13:12","13:49","14:24","14:52","15:24","15:56","16:30","17:00","17:32","18:04","18:30","19:05","19:32","20:02","20:10"]}},{"station":"SCHWEITZER","schedule":{"weekDays":["06:55","07:11","07:56","08:35","08:51","09:24","10:01","10:36","11:12","11:49","12:26","13:04","13:39","14:13","14:43","15:16","15:46","16:20","16:51","17:23",
@rigwild
rigwild / twitter_emojis.json
Last active November 3, 2018 21:26
All twitter emojis
[{t:"Visage rigolard",url:"https://abs.twimg.com/emoji/v2/72x72/1f600.png"},{t:"Visage souriant avec la bouche ouverte",url:"https://abs.twimg.com/emoji/v2/72x72/1f603.png"},{t:"Visage souriant avec la bouche ouverte et les yeux rieurs",url:"https://abs.twimg.com/emoji/v2/72x72/1f604.png"},{t:"Visage rigolard avec des yeux rieurs",url:"https://abs.twimg.com/emoji/v2/72x72/1f601.png"},{t:"Visage souriant avec la bouche ouverte et les yeux bien fermés",url:"https://abs.twimg.com/emoji/v2/72x72/1f606.png"},{t:"Visage souriant avec la bouche ouverte et une sueur froide",url:"https://abs.twimg.com/emoji/v2/72x72/1f605.png"},{t:"Visage avec des larmes de joie",url:"https://abs.twimg.com/emoji/v2/72x72/1f602.png"},{t:"Mort de rire à s'en rouler par terre",url:"https://abs.twimg.com/emoji/v2/72x72/1f923.png"},{t:"Visage souriant avec un halo",url:"https://abs.twimg.com/emoji/v2/72x72/1f607.png"},{t:"Visage faisant un clin d'œil ",url:"https://abs.twimg.com/emoji/v2/72x72/1f609.png"},{t:"Visage souriant avec des yeux
@rigwild
rigwild / 1_b-margin-padding.min.css
Last active February 13, 2019 00:56
Bootstrap margin and padding css. classes
/* Contains media queries */
.m-0{margin:0 !important}.mt-0,.my-0{margin-top:0 !important}.mr-0,.mx-0{margin-right:0 !important}.mb-0,.my-0{margin-bottom:0 !important}.ml-0,.mx-0{margin-left:0 !important}.m-1{margin:.25rem !important}.mt-1,.my-1{margin-top:.25rem !important}.mr-1,.mx-1{margin-right:.25rem !important}.mb-1,.my-1{margin-bottom:.25rem !important}.ml-1,.mx-1{margin-left:.25rem !important}.m-2{margin:.5rem !important}.mt-2,.my-2{margin-top:.5rem !important}.mr-2,.mx-2{margin-right:.5rem !important}.mb-2,.my-2{margin-bottom:.5rem !important}.ml-2,.mx-2{margin-left:.5rem !important}.m-3{margin:1rem !important}.mt-3,.my-3{margin-top:1rem !important}.mr-3,.mx-3{margin-right:1rem !important}.mb-3,.my-3{margin-bottom:1rem !important}.ml-3,.mx-3{margin-left:1rem !important}.m-4{margin:1.5rem !important}.mt-4,.my-4{margin-top:1.5rem !important}.mr-4,.mx-4{margin-right:1.5rem !important}.mb-4,.my-4{margin-bottom:1.5rem !important}.ml-4,.mx-4{margin-left:1.5rem !important}.m-5{margin:3rem !important}.mt-5,.
@rigwild
rigwild / clean-microsoft-history.js
Last active March 3, 2019 15:05
Quickly remove all the activity history from a Microsoft Account.
// Go to https://account.microsoft.com/privacy/activity-history
// Select "All activities" on the left panel.
// Open your browser's dev tools (F12), got to the console tab.
// Paste this script, it will load all the history elements and delete all activity.
// If you get spammed by errors in the console, turn your adblocker off temporarily.
// You will probably need to refresh the page and execute this script multiple times :
// The page is (IMHO) intentionnaly buggy to prevent people from deleting their data.
// Eventually everything will be clean.
@rigwild
rigwild / .eslintrc.js
Last active April 8, 2019 07:39
My Vue.js projet ESLint configuration
/*
rigwild's personal ESLint configuration
Using modern JavaScript syntax, very restrictive.
Preferably use with autofix on save.
This config is made for a Babel + Vue.js project (vue-cli).
https://github.com/rigwild
*/
@rigwild
rigwild / cleanDiscord.js
Last active June 15, 2019 10:32
A quick script to paste in the Discord's console to purge DM messages 🕵
count = 0
delay = ms => new Promise(resolve => setTimeout(resolve, ms))
clearMessages = async (token, channel, before, userId, amount = 50) => {
const baseURL = `https://discordapp.com/api/v6/channels/${channel}/messages`
const headers = { Authorization: token }
const messages = await fetch(`${baseURL}?before=${before}&limit=100`, { headers })
.then(res => res.json())