Skip to content

Instantly share code, notes, and snippets.

/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@gabihodoroaga
gabihodoroaga / WriteFileWithName.java
Created April 26, 2023 12:41 — forked from ayush-poddar/WriteFileWithName.java
WordCount GCS with custom output file name
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.coders.StringUtf8Coder;
import org.apache.beam.sdk.io.FileIO;
import org.apache.beam.sdk.io.TextIO;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.transforms.*;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.TypeDescriptors;
@gabihodoroaga
gabihodoroaga / SplitTableRowsIntoPartitions.java
Created April 26, 2023 12:40 — forked from pbrumblay/SplitTableRowsIntoPartitions.java
Apache Beam writing TableRows by partition column using FileIO writeDynamic
package com.fearlesstg.dataflow.pipelines;
import java.util.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.api.services.bigquery.model.TableRow;
import org.apache.beam.sdk.coders.StringUtf8Coder;
import org.apache.beam.sdk.io.Compression;
import org.apache.beam.sdk.io.FileIO;
#!/bin/bash
set -e
PROJECT_ID=$(gcloud config list project --format='value(core.project)')
ZONE=us-central1-a
CLUSTER_NAME=demo-cluster
gcloud container clusters \
create $CLUSTER_NAME \
#!/bin/bash
# resets coreaudiod if your mac does not recognize you audio devices (headphones, speakers, ...)
sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod
#!/bin/bash
set -e
echo "setup variables..."
ZONE=us-central1-a
CLUSTER_NAME=demo-gce-cluster
PROJECT_ID=`gcloud config list --format 'value(core.project)' 2>/dev/null`
REGISTRY="gcr.io/$PROJECT_ID"
GCP_USER=`gcloud config list --format 'value(core.account)' 2>/dev/null`

How to copy modified and new files from one repository to antother

# at source - archive all changes - including new files
git status -s | awk {'print $2'} | COPYFILE_DISABLE=1 tar --exclude tar_file.tar -cvf tar_file.tar -T -

# at destination - update the files
tar -xvf tar_file.tar
@gabihodoroaga
gabihodoroaga / app-deployment.yaml
Last active July 1, 2021 17:21
Deploy custom Ingress on GKE
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
@gabihodoroaga
gabihodoroaga / graph.go
Last active March 21, 2024 12:08
Simple app to test the graph shortest path for gonum and yourbasic/graph
package main
import (
"gonum.org/v1/gonum/graph"
"gonum.org/v1/gonum/graph/simple"
"gonum.org/v1/gonum/graph/traverse"
)
var (
wdg *LightWeightedGraph
# enable Full Disk Access for temrinal
# Go to System Preference -> Security & Privacy -> Full Disk Access
# get the list of your backups
sudo tmutil listbackups
# delete the backup
sudo tmutil delete snapshot_path
# disable full disk access for terminal