Skip to content

Instantly share code, notes, and snippets.

View YordanGeorgiev's full-sized avatar

Yordan Georgiev YordanGeorgiev

View GitHub Profile
@YordanGeorgiev
YordanGeorgiev / vue-if-else-logic.html
Created June 25, 2018 13:11
[how-to apply if-else logic in vue] how-to apply if else logic in vue #vue #html
<td v-for="key in columns">
<div v-if="key === 'id'">
it-{{entry[key]}}
</div>
<div v-else="key === 'id">
{{entry[key]}}
</div>
</td>
@YordanGeorgiev
YordanGeorgiev / call-udf-in-df.scala
Created June 18, 2018 11:12
[how-to call udf from df] how-to call udf per row in datafram with scala spark #scala #spark #df #udf
// this is the UDF - note the data type - should be a Java reflection compatible one !!!
val getUID = udf { (col1: String) =>
{
musa_wkt_eutrancellid match {
case null => UUID.randomUUID().toString
case _ => {
try {
broadCastedMap.value.get(col1).get.toString // obs return the same datatype as
} catch {
case e: java.util.NoSuchElementException => {
@YordanGeorgiev
YordanGeorgiev / linux-cheat-sheet.sh
Created June 8, 2018 12:37
[linux-cheat-sheet] linux cheat sheet #linux #cheat-sheet
# file:linux-cheat-sheet.sh v.1.9.5 docs at the end
# dns troubleshooting
dig host-dns.name
# how-many Answers !?
host host-dns.name
nslookup
# type g=max
@YordanGeorgiev
YordanGeorgiev / chrome-headless-cheat-sheet.sh
Last active June 7, 2018 13:59
[chrome-headless-cheat-sheet] chrome headless cheat sheet
export pdf_file='/path/to/pdf/file/dir/must/exist/some-file.pdf'
export url='http://some-host.com/note/use/single/qotes/because/of/?the-ampersand=value&is-problematic=yes'
# on mac it could be
lias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# on linux it might be
alias chrome=/usr/bin/chromium-browser
# action !!!
chrome --headless --disable-gpu --window-size=1200,900 --no-proxy-server --print-to-pdf=$pdf_file $url
@YordanGeorgiev
YordanGeorgiev / npm-cheat-sheet.sh
Created June 7, 2018 12:44
[npm-cheat-sheet]npm cheat sheet #npm #cheat-sheet #nodejs
# file: ~/.npm_opts.company
export http_proxy=http://100.114.1.1:9090
export https_proxy=https://100.114.1.1:9090
npm config set registry http://registry.npmjs.org/
npm config set proxy $http_proxy
npm config set https-proxy $https_proxy
npm config set strict-ssl false
set HTTPS_PROXY=$https_proxy
set HTTP_PROXY=$http_proxy
@YordanGeorgiev
YordanGeorgiev / how-to-create-parquet-file.scala
Created June 1, 2018 07:30
[how-to create parquet file with spark] how-to create parquet file with spark in scala #scala #spark #dataframe #parquet
df.write
.mode("overwrite")
.format("parquet")
.option("path", uri)
.saveAsTable(table)
@YordanGeorgiev
YordanGeorgiev / gitlab-api.sh
Last active April 30, 2018 07:44
[gitlab api via curl] how-to use gitlab api via curl #curl #gitlab #api #gitlab-api #private-token
curl -s -X GET \
--header "Private-Token: $gitlab_private_token" \
"$gitlab_url""$gitlab_proj_id" | jq .
echo get the pipelines
curl -s -X GET --header "Private-Token: $gitlab_private_token" \
"$gitlab_url""$gitlab_proj_id"/pipelines | jq .
echo get a job by id
job_id=1157220
@YordanGeorgiev
YordanGeorgiev / aws-cli-s3-api.sh
Last active December 10, 2018 05:07
[aws cli s3 how-to ] how-to aws cli s3 #aws #s3 #aws-cli #aws-s3-api
# configure your aws credentials
# file: ~.aws/credentials
[aws-profile-1]
endpoint-url=objectstorage.company.net:813
aws_access_key_id=AKIAA5QDLQ5sdfsdGMEQZMX
aws_secret_access_key=jveF4QVjUsdj6CzVouCPnm1lQyHqYV28F7EH7Tv
# bucket name: some-bucket name
[aws-profile-2]
@YordanGeorgiev
YordanGeorgiev / polygon-dia-graphviz.dot
Last active April 23, 2018 08:03
[polygon dia graph with GraphViz] how-to create a colored polygon dia graph with GraphViz #GraphViz #dia #polygon #graph
graph {
node[style=filled,color=cornflowerblue,fontcolor=white, fontsize=14];
edge[color=maroon,dir="both",arrowsize=.6];
requirements -- features;
requirements -- problems;
requirements -- userstories ;
userstories -- features;
userstories -- problems;
@YordanGeorgiev
YordanGeorgiev / git-branch-basics.sh
Created April 19, 2018 12:44
[git branch basics] git branch basics #git #branch
# how-to list all the local and remote branches and filter by to_srch string
git branch -a | grep -i $to_srch
# how-to branch from the current branch ( aka copy )
git branch copy_of_the_current_branch
# how-to check the differences between 2 branches
git diff src_branch..tgt_branch