Skip to content

Instantly share code, notes, and snippets.

View attibalazs's full-sized avatar
🌱
Ficus

Atti attibalazs

🌱
Ficus
View GitHub Profile
@attibalazs
attibalazs / gist:78c6968f9cbb76f79701
Last active April 19, 2020 21:14
jstree get_type example - Jstree
$(function () {
$('#jstree').on("select_node.jstree", function (e, data) {
switch (data.node.type) {
case "country":
alert("country");
break;
case "region":
alert("region");
break;
@attibalazs
attibalazs / Lottery Distribution
Created March 29, 2016 14:57
Lottery Simulator - it`s hard to win the lottery
import random
# example data
#generate random set
x = []
i = 1
while i < 10000000:
l = random.sample(range(1, 60), 6)
str1 = '-'.join(str(e) for e in l)
@attibalazs
attibalazs / .gitignore
Created April 14, 2016 10:36 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
# how can i exclude None values ?
#get minimum and maximum stock options
result = min(data_dict.values(), key=lambda v:v['exercised_stock_options'] if v['exercised_stock_options'] != 'NaN' else float('inf'))
print result
result = max(data_dict.values(), key=lambda v:v['exercised_stock_options'] if v['exercised_stock_options'] != 'NaN' else float('-inf'))
print result
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@attibalazs
attibalazs / file_list.py
Created May 5, 2016 13:41
Python script to do a file listing and log basic attributes to a csv file
import sys, os, time, csv
data_dir = os.path.join(os.getcwd(), os.pardir, 'data')
sys.path.append(data_dir)
with open(os.path.join(data_dir, "listing.csv"), 'w') as csvfile:
writer = csv.writer(csvfile)
row = ('path', 'modified_date', 'last_accesed_date', 'size')
writer.writerow(row)
for root, directories, filenames in os.walk('c:\\temp\\'):
for filename in filenames:
# shortform git commands
alias g='git'
# git commit random alias
git config --global alias.commit-random '!git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
usage: git commit-random
# get list of users public repos
curl "https://api.github.com/users/usernamehere/repos?type=owner&sort=updated" -s | sed -En 's|"name": "(.+)",|\1|p' | tr -d ' '
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@attibalazs
attibalazs / gist:10ad28464415ac4f62f1d263d798eca3
Created October 7, 2016 14:55 — forked from drorata/gist:146ce50807d16fd4a6aa
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
@attibalazs
attibalazs / Oracle_get_all_dependencies.sql
Created February 21, 2017 15:21
Get all dependencies for oracle table or view. A hierarchical query which goes through the dependency tree.
select distinct *
from all_dependencies a
start with a.referenced_name = 'TEST'
connect by NOCYCLE prior a.name = a.referenced_name;