Skip to content

Instantly share code, notes, and snippets.

View pbojinov's full-sized avatar

Petar Bojinov pbojinov

View GitHub Profile
@pbojinov
pbojinov / broadcast-channel.md
Created November 28, 2023 23:19 — forked from davestewart/broadcast-channel.md
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@pbojinov
pbojinov / memorySizeOfObject.js
Created March 25, 2019 23:50
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudformation:CreateUploadBucket",
"cloudformation:CancelUpdateStack",
"cloudformation:CreateStack",

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@pbojinov
pbojinov / 00-node6.config
Created March 6, 2018 06:50 — forked from Nainterceptor/00-node6.config
Quick & dirty hack to get NodeJS 6 on AWS Elastic BeanStalk
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeCommand
value: "npm start"
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeVersion
value: "4.4.3"
commands:
050-node-script-installer:
@pbojinov
pbojinov / blinkt-weather.py
Last active June 11, 2018 14:34 — forked from brentajones/blinkt-weather.py
A weather status script for the Raspberry Pi and Blinkt module - https://blog.bjones.net/2018/02/04/pi-blinkt-weather-status/
import json, time, os.path
import blinkt, requests
status_colors = {'current':[1,1,1],'high':[1,0,0],'low':[0,0,1],'precip':[0,1,0]}
blinkt.set_clear_on_exit()
blinkt.set_brightness(.1)
def getForecast(key,lat,lng):
url = 'https://api.darksky.net/forecast/' + key + '/' + str(lat) + ',' + str(lng)
@pbojinov
pbojinov / es_proxy.js
Created February 9, 2018 22:00 — forked from rveitch/es_proxy.js
Example Elasticsearch Proxy for Node.js
var express = require('express');
var request = require('request');
var app = express();
var port = Number(process.env.PORT || 3000);
var apiServerHost = (process.env.ELASTIC_URL || 'http://127.0.0.1:9200')
// Listen for requests on all endpoints
app.use('/', function(req, res, body) {
// short-circuit favicon requests for easier debugging
@pbojinov
pbojinov / US Zip Codes from 2013 Government Data
Created May 22, 2017 22:32 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993