Skip to content

Instantly share code, notes, and snippets.

View edwise's full-sized avatar
🎯
Focusing

Eduardo Antón edwise

🎯
Focusing
View GitHub Profile
@paulcalabro
paulcalabro / mmr_tcx_downloader.py
Last active May 8, 2023 18:28
This script downloads Training Center XML (TCX) files from MapMyRun
#!/usr/bin/env python3
from getpass import getpass
from requests import request
###########################################
# Prompt the user for required information.
###########################################
print('\n' + ('*' * 25) + ' Required Information: ' + ('*' * 25))
@squarism
squarism / iterm2.md
Last active May 24, 2025 09:20
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active November 27, 2024 13:36
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@dpsoft
dpsoft / EAM.java
Last active July 23, 2018 15:02
Execute Around Method Pattern: Java 8 vs Scala
import java.util.function.Consumer;
import static java.lang.System.out;
class JavaResource {
private JavaResource() {out.println("created...");}
public void operation1() {out.println("operation 1");}
public void operation2() {out.println("operation 2");}
private void close() { out.println("cleanup");}
public static void use(Consumer<JavaResource> block) {
@ideiudicibus
ideiudicibus / Beanutils.java
Created May 10, 2011 14:17
Merge two java beans useful when discovering differences
class Beanutils{
//merge two bean by discovering differences
private <M> void merge(M target, M destination) throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(target.getClass());
// Iterate over all the attributes
for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
// Only copy writable attributes
if (descriptor.getWriteMethod() != null) {