Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@ppar
ppar / terraform_separate_environments.md
Last active April 21, 2023 12:31
How to use a single Terraform repo with multiple independent environments

Summary

This text demonstrates a pattern for using a single repository of Terraform code to manage multiple, completely independent environments that contain the same infrastructure.

It's based on simply overriding the terraform data and config files on each execution with:

  • $TF_DATA_DIR
@bumi
bumi / yjs-pg-server.js
Created March 20, 2020 10:04
implementation of a websocket server storing yjs documents in a postgresql database
const WebSocket = require('ws');
const http = require('http');
const Y = require('yjs');
const wsUtils = require('./utils');
const cookie = require('cookie');
const QuillDelta = require('quill-delta');
//const QuillConverter = require('node-quill-converter');
//const MdastFromQuillDelta = require('mdast-util-from-quill-delta');
import css from "rollup-plugin-css-porter";
import pkg from "../../package.json";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import path from "path";
import commonjs from "rollup-plugin-commonjs";
import { terser } from "rollup-plugin-terser";
process.env.BABEL_ENV = "production";
process.env.NODE_ENV = "production";
@danieldietrich
danieldietrich / README.md
Last active February 14, 2024 13:15
The easiest way to bundle a simple TypeScript web application

THIS README IS OUTDATED AND UNMAINTAINED - PLEASE DON'T RELY ON THIS

The easiest way to bundle a simple TypeScript web application

Packaging JavaScript applications can be a bit overwhelming. The popular project uglifyjs does not support ES6, it is cumbersome to configure the allmighty Webpack, bundlers like Parcel and Microbundle still have bugs or do not compile to ESM bundles that work in a browser. It is hard to figure out the best way to bundle an application.

Here I give a small example, how we achieve the goal using the

@stafot
stafot / reset_virtualbox_dhcp_leases.sh
Last active November 3, 2020 11:15
Resets virtualbox DHCP leases to ensure that minikube will always take a specific IP.
#!/usr/bin/env bash
function minikube_reset_vbox_dhcp_leases() {
# Check OS version
case $OSTYPE in
darwin*)
VBOX_CONFIG_DIR=Library
;;
linux*)
@bradfitz
bradfitz / ws.go
Created November 5, 2018 17:06
pre-Go1.12 websocket hijack+proxy
httpsServer := &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hj, isHJ := w.(http.Hijacker)
if r.Header.Get("Upgrade") == "websocket" && isHJ {
c, br, err := hj.Hijack()
if err != nil {
log.Printf("websocket websocket hijack: %v", err)
http.Error(w, err.Error(), 500)
return
}
@Artistan
Artistan / A Readme for Adding Certs.md
Last active March 11, 2024 21:12
Add new certificate (cert) from local/internal intranet to your mac

Add a cert to you macbook

USAGE

~/add_cert.sh my.intra.net

you will be asked for your password to add thit to keychain

  • downloads pem file
  • adds to trusted root certificates
@smhatre59
smhatre59 / fileupload.js
Last active July 1, 2020 19:24
File upload using reactjs
import React, { Component } from 'react';
import './App.css';
/*
Screen:LoginScreen
Loginscreen is the main screen which the user is shown on first visit to page and after
hitting logout
*/
import LoginScreen from './Loginscreen';
/*
Module:Material-UI
@siakaramalegos
siakaramalegos / Document.es6
Created October 6, 2016 20:48
Updating style based on button click in React
import React, {Component, PropTypes} from 'react'
import View from './View'
import Button from '../common/Button'
export default class Document extends Component {
static propTypes = {
program: PropTypes.object.isRequired,
}
constructor() {