Skip to content

Instantly share code, notes, and snippets.

View iddan's full-sized avatar

Iddan Aaronsohn iddan

View GitHub Profile
@iddan
iddan / .bash_profile
Created July 14, 2020 20:45
My Bash Profile
#! /bin/bash
# Load all SSH keys
ssh-add -A 2>/dev/null;
# Enable colours
### Terminal
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
@iddan
iddan / settings.json
Created July 14, 2020 20:44
My VSCode settings.json
{
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": null,
"window.zoomLevel": 0,
"editor.fontSize": 14,
"editor.fontFamily": "Monaco, 'Courier New', monospace",
"terminal.integrated.shell.osx": "/usr/local/bin/bash",
"terminal.integrated.fontSize": 14,
"terminal.integrated.fontFamily": "Monaco",
"git.confirmSync": false,
@iddan
iddan / cayley-add-context-to-test-cases-documents.go
Created July 8, 2020 10:04
Script used for adding context to JSON-LD test cases documents in Cayley
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"github.com/piprate/json-gold/ld"
)
@iddan
iddan / delete-connections.js
Last active December 6, 2021 11:39
Batch delete connections on LinkedIn
// Get data
let d = [];
for (const element of document.querySelectorAll(".mn-connection-card")) {
d.push([element.querySelector("a").href, element.querySelector(".mn-connection-card__name").textContent.trim(), element.querySelector(".mn-connection-card__occupation").textContent.trim()])
}
// Copy data to clipboard
copy(JSON.stringify(d));
/*
@iddan
iddan / codemod.py
Created December 27, 2019 16:33
Refactor Cayley LinkedQL steps
import re
directory = "query/linkedql/"
with open(directory + "steps.go") as file:
content = file.read()
def convert(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
@iddan
iddan / flat_unzip.py
Created September 2, 2019 02:19
Transforms give iterables of tuples of iterables to tuples of iterables
from itertools import starmap, chain
def flat_unzip(iterable):
"""
Transforms given iterable of tuples of iterables to tuple of iterables
"""
return starmap(chain, zip(*data))
@iddan
iddan / notion_to_pandas.ipynb
Created August 20, 2019 07:28
Notion to Pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iddan
iddan / sync_pipfile_setup.py
Last active August 25, 2019 14:41
Sync Pipfile and setup.py
# Sync Pipfile with setup.py dependencies
# Assumptions:
# - You are running in a directory with Pipfile, Pipfile.lock & setup.py
# - Your setup.py calls a function named setup()
# - setup() is called with keyword arguments of install_requires and dependency_links (can be empty lists)
# - All your remote dependencies are HTTPS git
import pipfile
import ast
import json
@iddan
iddan / es_ideas.md
Created March 12, 2018 13:47
ES Ideas I want to propose / like

Array Update

Acts like objects but uses indeces as keys

const array = [ 1, 2, 3 ]
const newArray = [...array, 4: 5 ]

Iterable & Mapping Literals

@iddan
iddan / version.py
Last active October 30, 2017 20:57
Update python setup.py version safely
import ast
import jedi
from os import path
from pipenv.project import Project
from git import Repo
from git.refs.tag import TagReference
from pkg_resources import get_distribution
class Semver: