Skip to content

Instantly share code, notes, and snippets.

View petrbela's full-sized avatar

Petr Bela petrbela

View GitHub Profile
@petrbela
petrbela / chutedump.rb
Last active December 16, 2015 03:08
Downloads all assets from a chute to local folder
#!/usr/bin/env ruby
require 'FileUtils'
require 'net/http'
require 'open-uri'
require 'parallel'
require 'json'
print "Chute shortcut: "
chute_shortcut = gets.chomp
begin
@petrbela
petrbela / delete_broken_assets.rb
Created February 3, 2014 22:17
Remove broken assets from Chute album.
#!/usr/bin/env ruby
require 'FileUtils'
require 'net/http'
require 'open-uri'
require 'parallel'
require 'rest_client'
require 'json'
print "Chute ID: "
chute_id = gets.chomp
@petrbela
petrbela / Geo_distance.lua
Last active August 29, 2015 14:02
ApiTools SFPark geo distance middleware
return function(request, next_middleware)
local function geo_distance(lat1, lon1, lat2, lon2)
if lat1 == nil or lon1 == nil or lat2 == nil or lon2 == nil then
return nil
end
local dlat = math.rad(lat2-lat1)
local dlon = math.rad(lon2-lon1)
local sin_dlat = math.sin(dlat/2)
local sin_dlon = math.sin(dlon/2)
local a = sin_dlat * sin_dlat + math.cos(math.rad(lat1)) * math.cos(math.rad(lat2)) * sin_dlon * sin_dlon
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@petrbela
petrbela / keybase.md
Last active August 29, 2015 14:05
Keybase proof

Keybase proof

I hereby claim:

  • I am petrbela on github.
  • I am petrbela (https://keybase.io/petrbela) on keybase.
  • I have a public key whose fingerprint is C6BB 7046 2330 28DE C757 02CA 4A28 5F03 51EA 3821

To claim this, I am signing this object:

@petrbela
petrbela / rolling-restart.sh
Created May 12, 2015 19:35
Elasticsearch rolling restart
# Copied from https://github.com/logsearch/logsearch-boshrelease/blob/develop/share/util/elasticsearch-rolling-restart
#!/bin/bash
#
# perform a rolling restart of all data/master nodes in a stable cluster
#
# args: [-i|--interactive] [elasticsearch-host:port]
#
@petrbela
petrbela / Album.js
Last active March 26, 2017 19:12
GraphQL types in separate files
'use strict'
import {
GraphQLObjectType,
GraphQLString,
} from 'graphql'
import Types from './Types'
Types.Album = new GraphQLObjectType({
@petrbela
petrbela / 0_reuse_code.js
Created October 22, 2016 08:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@petrbela
petrbela / cloudSettings
Last active June 13, 2019 17:15
Visual Studio Code Sync Settings GIST
{"lastUpload":"2019-06-13T17:15:30.511Z","extensionVersion":"v3.2.9"}
@petrbela
petrbela / Install.md
Last active June 13, 2017 20:04
Install TF + CUDA on Mac

Notes from installing CUDA and TensorFlow on a MacBook Pro 15" 2013 with GeForce 650M

  1. Download CUDA and run installer (see notes)
  2. Go to System Preferences > CUDA and update driver version if prompted.
  3. Make sure deviceQuery lists your GPU
  4. Add cuda to syspath
    export PATH=$PATH:/usr/local/cuda/bin
  5. Download CuDNN (TF on pip currently compiled for version 5.x), unpack and move to /usr/local/cuda