Skip to content

Instantly share code, notes, and snippets.

View juandesant's full-sized avatar

Juande Santander-Vela juandesant

View GitHub Profile
@joezuntz
joezuntz / gist:4c791f9592d1798577da
Created November 14, 2014 14:12
Bayes Lecture 1 Medium Question Answer
{
"metadata": {
"kernelspec": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"display_name": "IPython (Python 2)",
"language": "python",
"name": "python2"
@juandesant
juandesant / sampy_sample_client.py
Created June 26, 2013 17:36
This gist shows how to use sampy to interact with different VO applications. It assumes you have sampy installed.
#!/usr/bin/env python
from sampy import *
import time
from pprint import pprint
# Setup hub by calling "start_samp_hub.py", it would contain:
# myhub = SAMPHubServer()
# myhub.start(True) # The True makes the script standalone; it should be called with
# alternatively, sampy (/usr/local/bin/sampy, for instance) can be called:
import subprocess
@juandesant
juandesant / Download proper KML file.scpt
Last active December 20, 2015 16:18
Drag-and-drop script to download standalone KML files that do not depend of a network connection, and that can be used with things like online converters, or iOS apps. See article describing the script (in Spanish) here: http://www.entremaqueros.com/bitacoras/memoria/?p=2455
on downloadUrl(theUrl, fileName)
set curlCmd to "curl -s -L -o " & fileName & " '" & theUrl & "' "
--display dialog curlCmd
do shell script curlCmd
end downloadUrl
on run {input, parameters}
set theUrls to {}
repeat with kmlFile in input
#!/usr/bin/env ruby
# PBS 4 Dec. 2013
# Renders HTML for all the .markdown files in the current directory.
# Gives each file a .html suffix.
# Saves them in a subfolder called HTML.
require 'rdiscount'
require 'find'
require 'fileutils'
@sklppr
sklppr / markdown2html.rb
Last active December 30, 2015 08:39 — forked from brentsimmons/generate_html.rb
Batch conversion of Markdown to HTML.
#!/usr/bin/env ruby
require "fileutils"
require "redcarpet"
OUTPUT_FOLDER = "html"
HTML_TEMPLATE = <<-HTML
<!DOCTYPE html>
<html>
@juandesant
juandesant / search_functions.sh
Last active August 14, 2016 14:18
Web-based search bash macros for Mac OS X
# This script only works in Mac OS X, due to the dependency
# on the `open` command.
# It can be directly added into a .profile file, either
# by copying and pasting its content, or sourcing the
# file:
# . search_functions.sh
# Usage: google any search terms
# Result: default browser opens with a query on any
@yzhang1991
yzhang1991 / scidb-install.txt
Last active January 25, 2018 15:00
Install SciDB
scp yzhang@linux04.cs.uh.edu:~/packages/scidb-15.7.0.9267.tgz ./
tar -xzf scidb-15.7.0.9267.tgz
mv scidb-15.7.0.9267/ scidbtrunk
sudo apt-get update
sudo apt-get -y install subversion expect openssh-server openssh-client
# The following environment variables should go into ~/.bashrc
export SCIDB_VER="15.7"
export SCIDB_SOURCE_PATH="/home/scidb/scidbtrunk"
@skreutzberger
skreutzberger / calliCloudUserIDAsync.swift
Created November 27, 2015 09:07
use iCloudUserIDAsync
import CloudKit
iCloudUserIDAsync() {
recordID, error in
if let userID = recordID?.recordName {
print("received iCloudID \(userID)")
} else {
print("Fetched iCloudID was nil")
}
}
@skreutzberger
skreutzberger / getICloudUserID.swift
Last active August 31, 2018 04:13
get iCloud User ID
import CloudKit
/// async gets iCloud record ID object of logged-in iCloud user
func iCloudUserIDAsync(complete: (instance: CKRecordID?, error: NSError?) -> ()) {
let container = CKContainer.defaultContainer()
container.fetchUserRecordIDWithCompletionHandler() {
recordID, error in
if error != nil {
print(error!.localizedDescription)
complete(instance: nil, error: error)