Skip to content

Instantly share code, notes, and snippets.

View kennethbruskiewicz's full-sized avatar

Kenneth Bruskiewicz kennethbruskiewicz

  • Vancouver, Canada
View GitHub Profile
@sergiodxa
sergiodxa / async-thread.js
Last active June 27, 2023 05:38
Use WebWorkers and promises to run sync heavy functions in a worker (process) and get the result in a promise
function asyncThread(fn, ...args) {
if (!window.Worker) throw Promise.reject(
new ReferenceError(`WebWorkers aren't available.`)
);
const fnWorker = `
self.onmessage = function(message) {
(${fn.toString()})
.apply(null, message.data)
.then(result => self.postMessage(result));
@mariocesar
mariocesar / README.md
Last active August 24, 2018 19:33
Useful docker containers

PostgreSQL

Creating a postgresql 9.5 container with persistent database

docker volume create pgdata
docker run --detach \
  --volume pgdata:/var/lib/postgresql/data \
  --name postgres \
 --env POSTGRES_PASSWORD=postgres \
@JamesSkemp
JamesSkemp / RP2SambaSeagate.md
Last active January 18, 2021 19:06
Raspberry Pi 2 Samba server w/ a Seagate Backup Plus Slim 1TB

Setting up a Raspberry Pi 2 Samba server (in early January 2016)

The following is how I configured a Raspberry Pi 2 as a samba server, using a Seagate Backup Plus Slim, 1TB, drive.

For ease I purchased the CanaKit Raspberry Pi 2 Complete Starter Kit. It runs about $70 and includes enough to get up and running with the Raspberry Pi 2, with the Pi itself, a nice case, power supply, HDMI cable, WiFi adapter, and SD card with NOOBS/Raspbian installer.

For the hard drive I opted to purchase a Seagate Backup Plus Slim 1TB Portable External Hard Drive, since I've had good enough luck with Seagate in the past, and reviews are generally favorable. This ran me $60. I confirmed that it worked fine on my Windows 10 machine, and was already formatted to NTFS.

Unfortunately, once I received the Pi and drive I found that the power supply/Pi wasn't putting off enough power to keep the drive running. After looking at the options, including tweaking the Pi to pass throu

@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2025 09:45
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
@cornhundred
cornhundred / .gitignore
Last active November 20, 2019 19:35
D3 Clustergram with zoom/panning, reordering, and search.
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@redguardtoo
redguardtoo / proj2ram
Last active May 17, 2022 18:12
script to copy project to tmpfs
#!/bin/sh
if [ -z "$1" ];then
echo "Usage:"
echo " proj2ram proj-name"
echo " proj2ram restore proj-name"
exit 1
fi
@isomorphisms
isomorphisms / how.to.strikethrough
Last active July 7, 2016 15:05
Flag flabby sentences.
Unicode[edit]
Combining characters[edit]
In plain text scenarios where markup cannot be used, Unicode offers a number of
combining characters that achieve similar effects.
The “combining long stroke overlay” (U+0336) results in an unbroken stroke
across the text:
@Hellowlol
Hellowlol / whatthefork
Last active November 21, 2022 07:55
Check all forked branches if they are ahead of master/self open in browser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dirty script to check if any forks in ahead of master and open that branch commitlist
Warning: Uses alot of api calls
"""
import requests
from requests.auth import HTTPBasicAuth
@acolyer
acolyer / service-checklist.md
Last active February 20, 2025 12:04
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?