Skip to content

Instantly share code, notes, and snippets.

@juanigallo
juanigallo / findDuplicates.js
Created September 8, 2017 18:11
Find duplicates in array.
function findDuplicates(arr) {
for (var i = 0; i < arr.length; i++){
if (arr[Math.abs(arr[i])] >= 0) {
arr[Math.abs(arr[i])] = -arr[Math.abs(arr[i])]
} else {
console.log(Math.abs(arr[i] + " "));
}
}
}
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git
@msohn
msohn / git-big-objects.sh
Last active June 26, 2023 15:31
Script to show n largest objects in a git repo's pack files.
#!/bin/bash
# -----------------------------------------------------------------------
# Copyright (C) 2013 Matthias Sohn <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#