Skip to content

Instantly share code, notes, and snippets.

View collegeimprovements's full-sized avatar
💭
☀️

Arpit Shah collegeimprovements

💭
☀️
View GitHub Profile
@collegeimprovements
collegeimprovements / nginx-gzip.conf
Created June 6, 2019 05:34 — forked from kilhage/nginx-gzip.conf
Enables gzip compression for common mime types in nginx
# most people include something like this. don't.
# check your default nginx.conf, it's already covered in a much better way.
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# compress proxied requests too.
# it doesn't actually matter if the request is proxied, we still want it compressed.
gzip_proxied any;
# a pretty comprehensive list of content mime types that we want to compress
# there's a lot of repetition here because different applications might use different
let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
@collegeimprovements
collegeimprovements / readme.md
Created March 8, 2019 05:27 — forked from arkadiyk/readme.md
Compiled EmberJS in Docker

Compiled EmberJS App in Docker

The biggest problem deploying compiled EmberJS apps as a container is the configuration defined during compile time and becomes part of the image. Which is not ideal as you probably want to move the image between QA/UAT and prod without any modification.

The solution I will describe here looks like a hack but it's been working for me.

  1. I put config <meta> tag into index.html:
@collegeimprovements
collegeimprovements / periodic_task.ex
Created December 6, 2018 03:43 — forked from trestrantham/periodic_task.ex
Run a task periodically natively in Elixir
defmodule MyApp.Periodically do
use GenServer
def start_link do
GenServer.start_link(__MODULE__, %{})
end
def init(state) do
Process.send_after(self(), :work, 2 * 60 * 60 * 1000) # In 2 hours
{:ok, state}
defmodule PushButton do
@behaviour :gen_statem
@name :pushbutton_statem
# Client API
def start do
:gen_statem.start({:local,@name}, __MODULE__, [], [])
end
@collegeimprovements
collegeimprovements / gist:760ca3b327232a88351739c15767ee0b
Created August 4, 2018 16:55 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@collegeimprovements
collegeimprovements / gitzip.sh
Created June 24, 2018 16:12 — forked from LeonardoCardoso/gitzip.sh
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o [email protected] HEAD
}
#... gitzip ZIPPED_FILE_NAME
@collegeimprovements
collegeimprovements / tutorial.md
Created June 17, 2018 04:41 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@collegeimprovements
collegeimprovements / gist:388266e63e8058e1f1837fd99ff5a473
Created June 1, 2018 03:52 — forked from komuw/gist:076231fd9b10bb73e40f
Shell script to generate server cert, key and client certs (all self-signed)
#! /usr/bin/env bash
# Create the CA Key and Certificate for signing Client Certs
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
# Create the Server Key, CSR, and Certificate
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr