Skip to content

Instantly share code, notes, and snippets.

View vguerra's full-sized avatar
💭
🏂

Victor Guerra vguerra

💭
🏂
View GitHub Profile
@vguerra
vguerra / plot.awk
Created October 4, 2021 05:29 — forked from katef/plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
diff --git a/utils/update_checkout/update_checkout/update_checkout.py b/utils/update_checkout/update_checkout/update_checkout.py
index 56e7ea24d4..54fcb18107 100755
--- a/utils/update_checkout/update_checkout/update_checkout.py
+++ b/utils/update_checkout/update_checkout/update_checkout.py
@@ -117,17 +117,17 @@ def update_single_repository(pool_args):
except Exception:
pass
- if checkout_target:
- shell.run(['git', 'status', '--porcelain', '-uno'],

Ex 1

document = sc.textFile("hdfs:///user/user172/5000-8.txt")
wordCounts = document.flatMap(lambda line: line.split()).map(lambda word: (word, 1)).reduceByKey(lambda left, right: left + right)
wordCounts.saveAsTextFile("hdfs:///user/user172/tp/wordcount")

Ex 2

@vguerra
vguerra / ast.txt
Created July 9, 2018 11:49
AST dump
(source_file
(top_level_code_decl
(brace_stmt
(defer_stmt
(func_decl implicit "$defer()" interface type='() -> ()' access=fileprivate
(parameter_list)
(brace_stmt
(call_expr type='()' location=../../../../examples/defer.swift:2:5 range=[../../../../examples/defer.swift:2:5 - line:2:28] nothrow arg_labels=_:
(declref_expr type='(Any..., String, String) -> ()' location=../../../../examples/defer.swift:2:5 range=[../../../../examples/defer.swift:2:5 - line:2:5] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
(tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=../../../../examples/defer.swift:2:11 range=[../../../../examples/defer.swift:2:10 - line:2:28] scalar_to_tuple elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
@vguerra
vguerra / latency.txt
Created September 8, 2016 11:57 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@vguerra
vguerra / gist:7103126
Created October 22, 2013 15:50
check if untracked file was previously deleted from repository
git ls-files -o | xargs git log -n 1 --diff-filter=D --format=format:%H --
@vguerra
vguerra / gist:5188572
Created March 18, 2013 16:33
Changing binary's rpath. nsd in this case.
chrpath -r ':/data/bin-exp/ns/lib::/data/bin-exp/tcl/lib' nsd
@vguerra
vguerra / gist:3737349
Created September 17, 2012 13:47
nstrace.tcl ( nsf compatibility )
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
@vguerra
vguerra / gist:3486875
Created August 27, 2012 09:22
Starting NaviServer on watchdog mode
#!/bin/sh
/bin/sleep 1
export LANG=en_US.UTF8
umask 002
# NaviServer
#export LD_LIBRARY_PATH=/usr/local/ssl/lib64
#export PATH=$PATH:/usr/local/pg/bin
@vguerra
vguerra / gist:2909190
Created June 11, 2012 09:05
Cloning openacs core and xo-friend packages (all git).
#!/bin/bash
# This script fetches automatically all needed packages
# to have an xowf application up and running.
# It dependes on the git-subtree utility ( which one can find