Skip to content

Instantly share code, notes, and snippets.

View mhvelplund's full-sized avatar
🦄
SwissArmyRonin

Mads Hvelplund mhvelplund

🦄
SwissArmyRonin
View GitHub Profile
@giuliano-macedo
giuliano-macedo / download_file.rs
Last active January 25, 2024 08:52
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@steenkamby
steenkamby / README.md
Last active September 21, 2020 11:55
Fresh mac install

install dev tools on a fresh mac

Run the script a couple of times to get through everything. Re-run later to update versions.

If you feel lucky:

bash <(curl -s https://gist.githubusercontent.com/steenkamby/e3ab7c35d2a08b1df1ef01c920999104/raw/1f3177546a3b31c857ae7d563dff0ec2d452ed93/install_mac.sh)
@appengineeringlab
appengineeringlab / Ubuntu-20-04-Hyper-V.sh
Created March 25, 2020 19:36
Ubuntu 20.04 on Hyper-V
# Follow https://techcommunity.microsoft.com/t5/virtualization/sneak-peek-taking-a-spin-with-enhanced-linux-vms/ba-p/382415
# xrdp.service not starting because address already in use: https://github.com/microsoft/linux-vm-tools/issues/94
# Get the scripts from GitHub
sudo apt-get update
sudo apt install git
git clone https://github.com/Microsoft/linux-vm-tools.git ~/linux-vm-tools
cd ~/linux-vm-tools/ubuntu/18.04/
#Make the scripts executable and run them...
@eladb
eladb / cdk8s-eks.ts
Created March 10, 2020 13:28
cdk8s + EKS = ❤️
import * as eks from '@aws-cdk/aws-eks';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk8s from 'cdk8s';
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import * as k8s from '../imports/k8s';
export class TestClusterStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
@skorfmann
skorfmann / Readme.md
Last active November 27, 2023 00:39
Private Api Gateway in CDK.

Private API Gateway with the AWS CDK

  • Lambda
  • Private Api Gateway
  • VPC Endpoint

NB: In order to access the Api Gateway through the public DNS of the VPC endpoint, a curl request has to have the api id as header. See also here

curl -i -H "x-apigw-api-id: " https://vpce-.execute-api..vpce.amazonaws.com/
@antonbabenko
antonbabenko / ecs-codedeploy
Last active November 16, 2022 23:25
This script performs deployment of ECS Service using AWS CodeDeploy
#!/usr/bin/env bash
#######################################################################
# This script performs deployment of ECS Service using AWS CodeDeploy
#
# Heavily inspired by https://github.com/silinternational/ecs-deploy ,
# which unfortunately can't be used to deploy ECS service when `deployment_option=ECS`
#
# Author: Anton Babenko
# URL: https://github.com/antonbabenko
@justinian
justinian / linux-x64-nasm-cheatsheet.md
Last active May 14, 2024 05:16
x64 NASM Cheat Sheet

x64 NASM cheat sheet

Registers

64 bit 32 bit 16 bit 8 bit
A (accumulator) RAX EAX AX AL
B (base, addressing) RBX EBX BX BL
C (counter, iterations) RCX ECX CX CL
D (data) RDX EDX DX DL
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active May 22, 2024 13:44
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@jcouyang
jcouyang / README.org
Last active July 20, 2024 04:29
Promise All with Limit of Concurrent N

The Promise All Problem

in case of processing a very large array e.g. Promise.all(A_VERY_LARGE_ARRAY_OF_XHR_PROMISE)

which would probably blow you browser memory by trying to send all requests at the same time

solution is limit the concurrent of requests, and wrap promise in thunk

Promise.allConcurrent(2)([()=>fetch('BLAH1'), ()=>fetch('BLAH2'),...()=>fetch('BLAHN')])