Skip to content

Instantly share code, notes, and snippets.

View dbrrt's full-sized avatar
🚲

David Barrat dbrrt

🚲
  • Switzerland
  • 11:01 (UTC +01:00)
View GitHub Profile
@dmh2000
dmh2000 / bcrypt-promise.js
Last active May 18, 2021 09:58
Using bcrypt with promises to hash a password and then verify it
const bcrypt = require("bcrypt");
// use this library in case your version of node doesn't support Promise
// const Promise = require("promise");
let password = "hello";
let stored_hash = "";
// first generate a random salt
function genSalt(password) {
return new Promise((resolve, reject) => {
@acdlite
acdlite / app.js
Last active July 22, 2025 08:36
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@bcherny
bcherny / react-rollup-typescript.md
Last active January 30, 2024 12:13
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active May 3, 2025 19:21
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@subfuzion
subfuzion / curl.md
Last active November 6, 2025 06:24
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@samuelcolvin
samuelcolvin / aiopg playing with aiohttp and gunicorn.md
Last active August 7, 2020 14:01
aiopg playing with aiohttp and gunicorn

aiopg playing with aiohttp and gunicorn

Setup

virtualenv -p /usr/bin/python3.5 env && source env/bin/activate
pip install SQLAlchemy aiohttp aiopg gunicorn

Usage

[LINUX MINT 17.2] Install Terraform

$ wget -P /tmp/ \
> https://releases.hashicorp.com/terraform/0.6.9/terraform_0.6.9_linux_amd64.zip && \
> [sudo] sudo mkdir /opt/terraform && \
> [sudo] unzip /tmp/terraform*.zip -d /usr/local/bin
@cgmartin
cgmartin / le-aws-upload-cert.sh
Last active April 30, 2023 13:09
Scripts for manually creating Let's Encrypt certificates for AWS S3/CloudFront
#!/bin/bash
# Usage:
# $ le-aws-upload-cert.sh
echo "Current list of certificates in AWS"
echo "-----------------------------------"
aws iam list-server-certificates
echo
read -p "Domain name: " domain_name
@twang2218
twang2218 / PentaxScsiProtocol.md
Last active February 25, 2020 20:09
This is the Pentax SCSI protocol

Pentax Camera SCSI protocol

  1. General

To control the Pentax camera, the camera has to be set to Mass Storage (MSC) mode, rather than PTP mode.

Vendor specific SCSI command is used to communicate with Pentax camera.

@hofmannsven
hofmannsven / README.md
Last active August 12, 2022 19:09
Notes on working with Tableau Server APIs