Skip to content

Instantly share code, notes, and snippets.

View ammachado's full-sized avatar

Adriano Machado ammachado

View GitHub Profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@ammachado
ammachado / ohmyposhv3-v2.json
Created October 11, 2023 13:59 — forked from shanselman/ohmyposhv3-v2.json
ohmyposhv3-v2
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@ammachado
ammachado / openshift_cli_tricks.MD
Created March 26, 2020 21:11 — forked from tuxfight3r/openshift_cli_tricks.MD
openshift cli tricks - using go templates

openshift list all pods and thier specs (requests/limits)

oc get pod -o jsonpath='{range .items[*]}{"SPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'

openshift list all pods and thier specs with name (requests /limits)

oc get pod -o jsonpath='{range .items[*]}{"NAME:  "}{.metadata.name}{"\nSPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}'
@ammachado
ammachado / iterm2.md
Created September 5, 2019 15:09 — forked from squarism/iterm2.md
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)

Think in Math. Write in Code.

Programmers love to discuss programming languages. Besides debating their own merits, we integrate them into our identities and even infer things about others who use them. Some even defend a form of [Linguistic Determinism][6] that thinking is limited to what is typable.

Since we spend so much time using languages, an interest in making them better is justified. However, the character of these debates suggests that we think of them as something more. Perhaps we have forgotten their primary role. Programming languages are implementation tools, not thinking tools.

@ammachado
ammachado / logger.ts
Created May 4, 2019 01:29 — forked from jkyoutsey/logger.ts
ngx logger class for consistent logging. Based on angular/cli's use of environments.
import { Injectable } from '@angular/core';
import { environment } from '@environments/environment';
/**
* Class of static methods to allow for consistent console logging.
* @export
*/
@Injectable({
providedIn: 'root'
library(utils)
b3_download_handler <- function(obj, data_ref, dest_dir) {
function () {
mapply(function(url_fname, fname) {
b3_file_downloader(url_fname, fname, dest_dir, data_ref)
}, obj$url_file, obj$filename)
}
}
bvbg_download_handler <- function(obj, data_ref, dest_dir) {
function () {
data <- as.Date(data_ref)
# if (obj$jump_to_current) {
# data <- today()
# }
data <- format(x=data, format="%y%m%d")
url <- 'http://www.bmfbovespa.com.br/pesquisapregao/download?filelist='
url <- paste(url, obj$url_file, data, '.zip', sep="")
@ammachado
ammachado / docker-unpack.py
Created June 28, 2018 21:39 — forked from bencord0/docker-unpack.py
Unpack a docker image.
#!/usr/bin/env python
import argparse
import json
import os
import sys
import tarfile
parser = argparse.ArgumentParser()
parser.add_argument(
'--image', '-i', required=True,
@ammachado
ammachado / AbstractTestsWithH2Rollback
Created June 28, 2018 21:37 — forked from brookslyrette/AbstractTestsWithH2Rollback
java backup and restore of h2 for unit tests
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {SampleApplication.class}, name = "acceptanceTestContext")
@WebIntegrationTest
public abstract class AbstractAcceptanceTests {
@Autowired
protected JdbcTemplate jdbcTemplate;
/**
* Backs up the database before running this test.