Skip to content

Instantly share code, notes, and snippets.

Avatar
🔬
Experimenting

Aymeric Beaumet aymericbeaumet

🔬
Experimenting
View GitHub Profile
@aymericbeaumet
aymericbeaumet / create-local-postgres-instance.md
Last active Jun 1, 2020
[Recipe] Create a local Postgres instance
View create-local-postgres-instance.md

I often want to start a local postgres instance within a foreground process using a data directory located in my project. I don't like relying on some system service. This is how I achieve this:

  1. Install Postgres (YMMV, I'm using Brew here):
brew reinstall postgres
  1. Initialize the Postgres cluster and update the .gitignore:
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active Oct 29, 2020
[Recipe] Delete all your likes/favorites from Twitter
View delete-likes-from-twitter.md

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
  }
@aymericbeaumet
aymericbeaumet / express-static.js
Last active Sep 4, 2019
Basic implementation of https://expressjs.com/en/4x/api.html#express.static, does not support any option.
View express-static.js
const express = require("express"); // https://expressjs.com/en/4x/api.html
const fs = require("fs"); // https://nodejs.org/api/fs.html
const path = require("path"); // https://nodejs.org/api/path.html
/*
* This function exists for convenience only. It allows to create a new
* middleware with the given parameters (here we only expect a single one: the
* root directory). It mimics the genuine express.static function signature
* (modulo the options argument).
*/
View useful-es6.js
import { EventEmitter } from 'events';
const number = 42;
export const say = (n = number) => `
My number is: ${n}
`;
export default class extends EventEmitter {
constructor(name, ...rest) {
View keybase.md

Keybase proof

I hereby claim:

  • I am aymericbeaumet on github.
  • I am aymericbeaumet (https://keybase.io/aymericbeaumet) on keybase.
  • I have a public key whose fingerprint is 9979 A61B 3577 119F CAF0 5F84 98A8 7F81 DCF7 32EA

To claim this, I am signing this object:

View misdirect.ion.land.js
// Send the key to http://xxxxxxxxxx.src.sr
function generateKey() {
var input = document.querySelector('#user-input').value
if (input.length >= 10) {
document.querySelector('#result').textContent = hash(input)
}
}
function hash(payload) {
@aymericbeaumet
aymericbeaumet / .gitignore
Last active Aug 29, 2015
Benchmarking Array.prototype.indexOf and Object in operator
View .gitignore
node_modules/
@aymericbeaumet
aymericbeaumet / manifest.js
Last active Sep 28, 2015
Duo.js: manifest proposal
View manifest.js
// This file serves as a manifest, packages are required but not used
require('org/somePackage@0.1.2');
require('org/otherPackage@canary')
@aymericbeaumet
aymericbeaumet / french-saints.json
Last active Jun 28, 2020
List of French Saints. Useful for calendar applications. Format: { "month/day": "saint name" }
View french-saints.json
{
"01/01": "Jour de l'An",
"01/02": "Saint Basile",
"01/03": "Sainte Geneviève",
"01/04": "Saint Odilon",
"01/05": "Saint Edouard",
"01/06": "Saint André",
"01/07": "Saint Raymond",
"01/08": "Saint Lucien",
"01/09": "Sainte Alix",
You can’t perform that action at this time.