Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
shopt -s extglob
set -o errtrace
set -o errexit
set -o pipefail
echo "running"
echo $MY_VAR
@abronte
abronte / upload.sh
Last active November 6, 2023 21:33
#!/usr/bin/env bash
# check if semgrep is installed
if ! command -v semgrep &> /dev/null
then
echo "semgrep could not be found"
exit
fi
# check if snyk is installed
@abronte
abronte / test.sh
Last active November 6, 2023 17:29
#!/usr/bin/env bash
shopt -s extglob
set -o errtrace
set -o errexit
set -o pipefail
echo "running script"
while read line
from pyspark_gateway import PysparkGateway
pg = PysparkGateway()
from pyspark import SparkContext, SparkConf
conf = conf.set('spark.io.encryption.enabled', 'true')
sc = SparkContext(gateway=pg.gateway, conf=conf)
spark = SparkSession.builder.getOrCreate()
df = spark.read.parquet('hdfs://data/my_table.parquet')
@abronte
abronte / spark_application.py
Created November 7, 2019 00:27
Pyspark Gateway spark context initialization
from pyspark_gateway import PysparkGateway
pg = PysparkGateway()
from pyspark import SparkContext, SparkConf
conf = conf.set('spark.io.encryption.enabled', 'true')
sc = SparkContext(gateway=pg.gateway, conf=conf)
from datachute import DataChute
ds = DataChute('d131dd02c5e6eec4')
df.send('my_project', 'some data')
@abronte
abronte / keybase.md
Last active October 16, 2017 05:57
keybase

Keybase proof

I hereby claim:

  • I am abronte on github.
  • I am adambronte (https://keybase.io/adambronte) on keybase.
  • I have a public key ASA51USwCT7mo5Tzsdsll-IGrNyI-UD_CNd3CDjN7p7MFwo

To claim this, I am signing this object:

@abronte
abronte / train.rb
Last active February 24, 2016 19:21
Ruby liblinear model training
require 'liblinear'
# reference
# games = {1 => "csgo", 2 => "dota2", 3 => "hearthstone", 4 => "minecraft", 5 => "starcraft"}
# Setting parameters
param = Liblinear::Parameter.new
param.solver_type = Liblinear::L2R_LR
label_ids = {}
@abronte
abronte / opencv_histogram.rb
Last active February 17, 2016 00:28
Ruby opencv histogram
# create_dataset.rb
require 'opencv'
def hist(file)
iplimg = OpenCV::IplImage.decode_image(open(file).read)
b, g, r = iplimg.split
dim = 3
sizes = [8,8,8]
ranges = [[0, 255],[0, 255],[0, 255]]
@abronte
abronte / gist:ee88ef1a45587922ceb9
Created February 11, 2015 23:53
ruby 2.0 aws-sdk-core get_object
before :: Memory 19360KB
after :: Memory 21228KB
before :: Memory 21228KB
after :: Memory 21240KB
before :: Memory 21240KB
after :: Memory 21272KB
before :: Memory 21272KB
after :: Memory 21304KB
before :: Memory 21304KB
after :: Memory 21328KB