Skip to content

Instantly share code, notes, and snippets.

View attilapiros's full-sized avatar

Attila Zsolt Piros attilapiros

View GitHub Profile
@attilapiros
attilapiros / gist:8181870
Created December 30, 2013 13:02
bookmarklet with JQuery (base)
(function(){
// the minimum version of jQuery we want
var v = "1.3.2";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
@attilapiros
attilapiros / gist:8181913
Last active January 1, 2016 18:09 — forked from attilapiros/gist:8181870
JQuery based bookmarklet solution to collect youtube links (not working when CSP denies acces to ajax.googleapis.com).
(function(){
// the minimum version of jQuery we want
var v = "1.3.2";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
(ns roman-nums.core
(:require
[clojure.test :refer [testing are]]))
(def ^:private roman-digits
[[1000 "M"] [900 "CM"]
[500 "D"] [400 "CD"]
[100 "C"] [90 "XC"]
[50 "L"] [40 "XL"]
[10 "X"] [9 "IX"]
(ns roman-nums.core
(:require
[clojure.test :refer [testing are]]))
(def ^:private roman-digits ["I" "V" "X" "L" "C" "D" "M"])
(def ^:private roman-partitions
(partition 3 2 roman-digits))
(defn ^:private num-to-roman-one-digit [c low middle high]
@attilapiros
attilapiros / clean_code.md
Created June 2, 2017 08:59 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@Test
public void speedTest() {
int n = 500;
int oneBuffSize = 100000;
System.out.println("n = " + n);
byte buffArray[][] = new byte[n][];
for (int j = 0; j < n; j++) {
byte buff0[] = new byte[oneBuffSize];
for (int i = 0; i < oneBuffSize; i++) {
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
#!/usr/bin/env python
from github import Github
import configparser, os
config = configparser.ConfigParser()
config.read([os.path.expanduser('~/.github_access_token.cfg')])
github = Github(config['github.com']['AccessToken'])
repo = github.get_repo('kubernetes/minikube')
#!/bin/zsh
minikube_assets=(
# output of https://gist.github.com/attilapiros/027aa466cd83a3074610f016535e86a2#file-github-release-sweeper-py
https://github.com/kubernetes/minikube/releases/download/v1.18.0/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.17.1/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.17.0/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.16.0/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.15.1/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.15.0/minikube-darwin-amd64
#!/bin/zsh
minikube_assets=(
# output of https://gist.github.com/attilapiros/027aa466cd83a3074610f016535e86a2#file-github-release-sweeper-py
https://github.com/kubernetes/minikube/releases/download/v1.18.1/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.18.1/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.17.1/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.17.0/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.16.0/minikube-darwin-amd64
https://github.com/kubernetes/minikube/releases/download/v1.15.1/minikube-darwin-amd64