Skip to content

Instantly share code, notes, and snippets.

# Apo list tuples se dictionary key: lista. eg
# results = [("word1", "explaination1"), ("word2", "explaination2"), ("word1", "explaination12")]
# ->
# data = {"word1": ["explaination1", "explaination12"], "word2": explaination2}
data = {}
for i in results:
data.setdefault(i[0],[]).append(i[1])
# exigisi:
/*
Filter a list is JS is an attribute of an array (array.filter) and takes one argument, a function to apply
to each list element if the return value of the function is True then the element is in the result list, otherwise
it is discarded
Example for filter
arr = ['some text', 'a', 'some more text', 'the', 'I go to play football']
Goddady + Heroku + Domain
* disable domain from github
* Heroku hobby version
* Heroku add domain www.egg-fights.com, www.tsougkrizo.com
* Godday set in CNAME www that weird thing HEROKU gives for each the domain
Forwarding domain -> https://www.tsougkrizo.com
Forwarding domain -> https://www.egg-fights.com
Goddady with redirect
* Heroku disable custom domain
from collections import namedtuple, defaultdict
from pprint import pprint
#filename = 'small_input.txt'
filename = 'input.txt'
Recipe = namedtuple('Recipe', 'ingr allerg')
recipes = []
def in_level(x, y, z, w, sizex, sizey, sizez, sizew):
return 0 <= x < sizex and 0 <= y < sizey and 0 <= z < sizez and 0 <= w < sizew
def active_neighbours(x, y, z, w, sizex, sizey, sizez, sizew, levels):
active = 0
for u in range(w - 1, w + 2):
for k in range(z - 1, z + 2):
for j in range(y - 1, y + 2):
def in_level(x, y, z, sizex, sizey, sizez):
return 0 <= x < sizex and 0 <= y < sizey and 0 <= z < sizez
def active_neighbours(x, y, z, sizex, sizey, sizez, levels):
active = 0
for k in range(z - 1, z + 2):
for j in range(y - 1, y + 2):
for i in range(x - 1, x + 2):
@mei-li
mei-li / bq.md
Created December 16, 2020 16:59

Query to get all required data for one pulication

select
  p.id, doi, pmid, pmcid, p.title, p.abstract.preferred, acknowledgements.preferred, journal.title, book_series_title.preferred,
  proceedings_title , mesh_terms, date, year, volume, issue, pages, type,
  au.first_name, au.last_name, au.raw_affiliations, au.corresponding, au.researcher_id, au.grid_ids,
  p.research_orgs,
  grid.name, grid.id, grid.address.city , grid.address.country, grid.address.state
  funder_orgs,

fgrid.address.country, fgrid.name,

@mei-li
mei-li / gist:0b3d9535dfb95ad5f802956301434774
Created December 2, 2020 11:33
Visual studio code - My shortcuts
Clt - Shift - P # commands
Clt - , # edit settings
Clt - p # open file
Clt - Shift - / (next to shift) # dublicate line
# useful commands
Reorg imports
Reload window

Get hardware info

inxi -Fxz sudo lshw -c video sudo dmidecode | less

TODO

  • What is dmesg do???
  • What about other logs
  • What is kernel and how it plays with X, ubuntu, LTS releases