Skip to content

Instantly share code, notes, and snippets.

View Kritner's full-sized avatar

Russ Hammett Kritner

View GitHub Profile
/******** ANSWERS ********/
// ⭐: 1
const addThemAllUp = frequencyChanges => frequencyChanges.reduce((a, b) => a + b)
// ⭐: 2
const findFirstRepeatedFrequency = frequencyChanges => {
let index = 0
let currentFrequency = 0
const frequencies = new Set()
@5818959
5818959 / gist:b9f392d75ea2ca0d09cb63bf645bc666
Created August 24, 2017 08:06
Git diff between two commits filtered by files extension
# full diff
git diff <SHA1> <SHA1> -- `find . -name '<pattern>'`
# only file names
git diff <SHA1> <SHA1> --name-status -- `find . -name '<pattern>'`
@vasanthk
vasanthk / System Design.md
Last active September 19, 2024 19:42
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@soheilhy
soheilhy / nginxproxy.md
Last active September 19, 2024 06:16
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@emiller
emiller / git-mv-with-history
Last active April 17, 2024 21:06
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@danielestevez
danielestevez / gist:2044589
Last active September 14, 2024 10:40
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@dmorrison
dmorrison / gist:942148
Created April 26, 2011 12:06
Remove ASP.NET membership objects from SQL Server
-- Removes all objects (in the correct order) added to
-- SQL Server by the stock ASP.NET membership provider
drop table aspnet_PersonalizationAllUsers
drop table aspnet_PersonalizationPerUser
drop table aspnet_Profile
drop table aspnet_SchemaVersions
drop table aspnet_UsersInRoles
drop table aspnet_WebEvent_Events
drop table aspnet_Paths
drop table aspnet_Membership