Skip to content

Instantly share code, notes, and snippets.

@pdib
pdib / .bash_profile
Last active September 4, 2017 12:27 — forked from natelandau/.bash_profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@pdib
pdib / .ebextensions\deploy.config
Last active April 5, 2022 07:39
Installing node and npm on a Django AWS ElasticBeanstalk
# This specifies the deployment process on AWS ElasticBeanstalk for a Django app using npm and Postgres.
#
# The target environment should have access to a Postgres Database through environment variables.
# The environment can be setup using `eb create --database.engine=postgres`
# The necessary environment variables to access the database will be automatically defined on the
# instances of that environment.
#
# In addition, the target environment should define environment variables (django secret key ...).
# They can be manually defined using the AWS ElasticBeanstalk interface on the web.
# They can also be specified when creating the environment from command line, for example:
@pdib
pdib / loading.ts
Last active November 25, 2015 18:35
Create a loading spinner that disappears once the content is loaded with Angular 2.
import { Component, ComponentRef, Directive, DynamicComponentLoader, TemplateRef, ViewContainerRef } from 'angular2/angular2';
@Component({
selector: 'spinner',
template: `<h1>spinner</h1>` // This will be displayed while loading.
})
class Spinner {
}
#define _ENABLE_ATOMIC_ALIGNMENT_FIX 1
#include <iostream>
#include <thread>
#include <array>
#include <atomic>
#include <memory>
#include <Windows.h>
#include <variant>
#include <vector>
#define _ENABLE_ATOMIC_ALIGNMENT_FIX 1
#include <iostream>
#include <thread>
#include <array>
#include <atomic>
#include <memory>
#include <Windows.h>
#include <variant>
#include <vector>
@pdib
pdib / kmp.cpp
Last active June 28, 2017 14:19
KMP
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// This one uses a slightly different table
// It's probably easier to remember.
// The table LPS contains at LPS[i] the size of the Longest Proper Prefix of p[0..i] that is also a Suffix of p[0..i].
vector<int> computeLPS(string& p)
@pdib
pdib / App.tsx
Created July 25, 2019 11:21
Use adal-angular to login and call APIs with Microsoft authentication
import React, { useState } from "react";
import AuthenticationContext from "adal-angular";
import "./App.css";
// Use the AppId and redirectUri you get after registering your App in the Azure Portal.
// https://docs.microsoft.com/en-us/graph/auth-register-app-v2
const authContext = new AuthenticationContext({
clientId: "<AppId-from-azure-portal>",
popUp: false,
redirectUri: "http://localhost:8000",