Skip to content

Instantly share code, notes, and snippets.

View arthurlacoste's full-sized avatar

Arthur Lacoste arthurlacoste

View GitHub Profile
@arthurlacoste
arthurlacoste / gitignore_dsstore.sh
Last active April 14, 2022 06:50
Gitignore DS_Store files globbaly on Mac OS
mkdir ~/git/
echo ".DS_Store" >> ~/git/.gitignore_global
echo "._.DS_Store" >> ~/git/.gitignore_global
echo "**/.DS_Store" >> ~/git/.gitignore_global
echo "**/._.DS_Store" >> ~/git/.gitignore_global
git config --global core.excludesfile ~/git/.gitignore_global
<?php
class CloudflareCache
{
/**
* Purge tout le cache Cloudflare
* @return string
*/
public static function purgeAllCloudflareCache() {
$cmd = "curl -X POST \"https://api.cloudflare.com/client/v4/zones/" . CLOUDFLARE_ZONE . "/purge_cache\" \
@arthurlacoste
arthurlacoste / MySQL_macOS_Sierra.md
Created January 29, 2018 10:18 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

php -S 127.0.0.1:8000 -t public
@arthurlacoste
arthurlacoste / after.js
Last active January 10, 2018 06:57
Exemple 2 of converting promise & callback functions to async/await. Ref to this project : https://github.com/arthurlacoste/listme/blob/master/src/apicore.js#L139
// Set custom slug if is not already exists
const setSlug = async (req, res, path) => {
const adapter = new FileAsync(path);
const ndb = await low(adapter);
const list = ndb.getState();
list.id = slugme(req.body.slug);
const newPath = dbpath('items', list.id);
const urlTaken = await fileExist(newPath);
@arthurlacoste
arthurlacoste / upload_api.php
Last active November 22, 2017 10:29
Straight forward upload api for cURL usage
<?php
/**
* Example :
* curl -F "f=@/my/file" https://myapi -o /tmp/up && cat /tmp/up
*/
if (isset($_FILES['f'])) {
$baseurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] &&
@arthurlacoste
arthurlacoste / staticWordpress.user.js
Created November 15, 2017 11:37
Edit media Wordpress to a custom adress
// ==UserScript==
// @name WordPress.com Use static
// @namespace https://arthurlacoste.com
// @version 1.0.0
// @description Edit media Wordpress to a custom adress
// @author Arthur Lacoste <[email protected]>
// @match https://wordpress.com/media/
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://raw.githubusercontent.com/pietrasiak/jquery.initialize/master/jquery.initialize.min.js
// @grant GM_getValue
/**
* Push an element if is not already exist in the array
* @param {Array} element object
* @param {String} compare string to add
* @return {Array}
*/
const pushIfNotExist = function (element, compare) {
if (element.indexOf(compare) === -1) {

https://gist.github.com/

magnet:?xt=urn:btih:af92692cd26af80eb0bfaa2edca470cc73426234&dn=winegold-win32-x64&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com

Windows test for winegold: https://instant.io/#af92692cd26af80eb0bfaa2edca470cc73426234 https://www.dropbox.com/s/ngf9mtfgkd5jhdi/winegold-win32-x64.zip?dl=0

@arthurlacoste
arthurlacoste / Update remote repo
Created October 19, 2017 07:11 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket