Skip to content

Instantly share code, notes, and snippets.

@ro-tex
ro-tex / git-aliases.md
Created November 29, 2022 11:03 — forked from tyomo4ka/git-aliases.md
The Ultimate Git Alias Setup on OS X (brew)

The Ultimate Git Alias Setup on OS X (brew)

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bash_profile
@ro-tex
ro-tex / main.sol
Last active November 9, 2022 13:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract PriceConsumerV3 {
AggregatorV3Interface internal priceFeed;
/**
@ro-tex
ro-tex / HelloWorld.sol
Last active November 9, 2022 12:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/**
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
* DO NOT USE THIS CODE IN PRODUCTION.
*/
contract HelloWorld {
@ro-tex
ro-tex / mongo_rs.sh
Last active September 29, 2021 11:22
MongoDB test replica set with a single container
#!/bin/zsh
# You will need a keyfile. This is how you generate one:
# `openssl rand -base64 756 > mgkey`
# It needs to have specific permissions, so `chmod 400 mgkey` it.
# Start the MongoDB container.
docker run \
-d \
--rm \
@ro-tex
ro-tex / tamper_wide_github.js
Created November 5, 2019 10:13
Wide github.com
// ==UserScript==
// @name Wide github.com
// @namespace http://tampermonkey.net/
// @version 0.1
// @description make github.com 100% wide
// @author Ivaylo Novakov
// @match https://github.com/*
// @grant none
// ==/UserScript==
@ro-tex
ro-tex / pre-push
Created October 29, 2019 17:27
pre-push hook for ensuring .env.dist matches .env
#!/usr/bin/ruby
unless(File.exist?('.env'))
# We're not using a .env, so we don't need to check anything
exit 0
end
unless(File.exist?('.env.dist'))
puts 'Cannot commit while you have a .env and not a .env.dist. Please create a descriptive .env.dist.'
exit 1
Installing an older version of a Homebrew package:
1. `git clone git@github.com:Homebrew/homebrew-core.git`
2. Go into homebrew-core/Formula and find your formula (e.g. kibana.rb)
3. `git log kibana.rb`
4. Find the id of the commit that creates or updates that version (for version 6.0.1 that is b7f9249c69beb918f322c165595f1a2d3b1a1608).
5. `brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/b7f9249c69beb918f322c165595f1a2d3b1a1608/Formula/kibana.rb`
6. Prevent it from being updated by calling `brew pin kibana`.
@ro-tex
ro-tex / ASS.md
Created July 9, 2018 08:29 — forked from klaaspieter/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@ro-tex
ro-tex / tamper.js
Created May 22, 2018 08:56
Tampermonkey: Strip header/footer from medium.freecodecamp.org
// ==UserScript==
// @name Strip header/footer from medium.freecodecamp.org
// @namespace http://tampermonkey.net/
// @version 0.1
// @description stip header/footer
// @author Ivaylo Novakov
// @match https://medium.freecodecamp.org/*
// @grant none
// ==/UserScript==
@ro-tex
ro-tex / getCloudWatchLogs.rb
Last active February 12, 2018 12:34
Downloads all CloudWatch logs for a given lambda that have the given prefix
require 'json'
if (!ARGV[0] || !ARGV[1])
puts "Usage: $ ruby getCloudWatchLogs.rb [log group name, e.g. /aws/lambda/myLambda] [log stream prefix, e.g. 2018/02/01/[123]]"
exit
end
logGroupName = ARGV[0]
logStreamPrefix = ARGV[1]