Skip to content

Instantly share code, notes, and snippets.

@bzg
bzg / gouv.fr.csv
Last active June 5, 2024 04:35
Liste de noms de domaines en .gouv.fr (données AFNIC + collecte ad hoc)
Nom de domaine Pays BE Departement BE Ville BE Nom BE Sous domaine Type du titulaire Pays titulaire Departement titulaire Domaine IDN Date de crtion Date de retrait du WHOIS
08victimes.gouv.fr FR 49 ANGERS NAMESHIELD gouv.fr ORG FR 75 0 31-05-2005
1000paysages.gouv.fr FR 49 ANGERS NAMESHIELD gouv.fr ORG FR 75 0 06-03-2015
100projetspourleclimat.gouv.fr FR 49 ANGERS NAMESHIELD gouv.fr ORG FR 75 0 19-04-2016
2019.semaine-industrie.gouv.fr
24octobre.gouv.fr FR 72 SAINT SATURNIN DIGITAL RURAL INFORMATIQUE gouv.fr ORG FR 75 0 10-10-2012
3939.gouv.fr FR 49 ANGERS NAMESHIELD gouv.fr ORG FR 75 0 04-06-2007
92.accueil-etrangers.gouv.fr
95.accueil-etrangers.gouv.fr
abonnement-presse.gouv.fr FR 75 PARIS GANDI gouv.fr ORG FR 75 0 17-04-2019
@agm1984
agm1984 / reactScrollPositionY.js
Created February 23, 2018 06:45
How to get Y scroll position in React
import React, { Component } from 'react'
import UserDetails from './UserDetails'
/**
* This utility function allows function calls to be debounced.
* @param {Function} func Function that requires debouncing
* @param {Number} wait Wait time in milliseconds between successive invocations
*/
const debounce = (func, wait) => {
let timeout
@joepie91
joepie91 / random.md
Last active April 11, 2025 09:42
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

#!/bin/bash
# WARNING
# This expects your repository to be in ~/git . If your repository is elsewhere you will need to alter the script.
# SYNOPSIS
# git_cleanup [repo name] [-xl]
# DESCRIPTION
# This script allows people to delete (-x) the history of a directory OR destroy (-l) the history of a directory and just
#!/bin/bash
if [ $# -lt 2 ]; then
echo "format: git_cleanup <repo name> [-x/--expunge <directory 1> -l/--keeplatest <directory 2> ...]"
exit
fi
PROJ="$1"
shift
@willurd
willurd / web-servers.md
Last active April 14, 2025 05:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@JeffreyWay
JeffreyWay / set-value.md
Created July 28, 2012 19:09
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');