Skip to content

Instantly share code, notes, and snippets.

View alexabruck's full-sized avatar
🍉

Alexa Steinbrück alexabruck

🍉
View GitHub Profile
@mattdesl
mattdesl / cli.js
Created September 13, 2022 10:37
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
1. Check that your Raspberry Pi actually has a WiFi Module built in :-)
2. Check your wpa_supplicant.conf File in /boot directory (Here's an example file: https://gist.github.com/alexabruck/16e3f04ae1d9c883bf5b1f1b5c9d08b2)
- formatting (no whitespace around the equal signs)?
- country code correct?
- typos?
- windows line endings are problematic
3. Check your Router settings
- Is a MAC Filter active?
- 2.4GHz or 5GHz? Raspberry Pi Zero will only work with 2.4GHz
- Is the SSID hidden? If yes, then you need to add scan_ssid=1 to the network settings in wpa_supplicant.conf File
@gaearon
gaearon / index.html
Last active January 26, 2024 11:25
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
**Jeff Escalante**
# Dato & Contentful
There are many areas in which I'd consider Dato to be much stronger of a CMS than
contentful, and one in which I'd consider the opposite to be the case. I will try to be as
balanced as possible with this overview, as I am not employed by dato or anything ‐ my
goal is to ensure that my clients and developers get the best possible experience working
with a CMS.
@scriptex
scriptex / rename.js
Last active April 10, 2023 23:30
Rename all files in a folder with NodeJS
const { join } = require('path');
const { readdirSync, renameSync } = require('fs');
const [dir, search, replace] = process.argv.slice(2);
const match = RegExp(search, 'g');
const files = readdirSync(dir);
files
.filter(file => file.match(match))
.forEach(file => {
const filePath = join(dir, file);
@boeric
boeric / README.md
Last active March 3, 2024 05:47
D3 Real Time Chart with Multiple Data Streams

D3 Based Real Time Chart with Multiple Streams

The real time chart is a resuable Javascript component that accepts real time data. The purpose is to show the arrival time of real time events (or lack thereof), piped to the browser (for example via Websockets). Various attributes of each event can be articulated using size, color and opacity of the object generated for the event.

The component allows multiple asynchronous data streams to be viewed, each in a horizontal band across the SVG. New data streams can be added dynamically (as they are discovered by the caller over time), simply by calling the yDomain method with the new array of data series names. The chart will automatically fit the new data series into the available space in the SVG.

The chart's time domain is moving with the passage of time. That means that any data placed in the chart eventually will age out and leave the chart. Currently, the chart history is capped at five minutes (but can be changed by modifying the comp

@paulirish
paulirish / what-forces-layout.md
Last active May 9, 2024 07:00
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@mcobzarenco
mcobzarenco / wikidata.py
Created July 7, 2015 17:29
Parse wikidata dump in Python
#!/usr/bin/env python
from __future__ import print_function, division
import argparse
import json
import sys
from gzip import GzipFile
def concat_claims(claims):
for rel_id, rel_claims in claims.iteritems():