Skip to content

Instantly share code, notes, and snippets.

View stefco's full-sized avatar
😳

Stefan Countryman stefco

😳
View GitHub Profile
@davemkirk
davemkirk / Vagrantfile
Created April 4, 2015 20:23
Jupyter (aka IPython Notebook) Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
@olberger
olberger / shibb-cas-get.sh
Created December 4, 2014 09:59
Connection to a web app protected via Shibboleth with curl
#!/bin/sh
#set -x
# Usage: shibb-cas-get.sh {username} {password} # If you have any errors try removing the redirects to get more information
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method)
DEST=https://myapp.example.com/
SP=https://myapp.example.com/index.php
IDP="https://myidp.example.com/idp/shibboleth&btn_sso=SSOok"
@aldro61
aldro61 / popcount_array.pyx
Last active October 2, 2023 13:07
Popcount of a numpy array of 32-bit integers
"""
Compile with gcc flag -mpopcnt
"""
import numpy as np
cimport numpy as np
cimport cython
from libc.stdint cimport uint32_t, uint8_t
cdef extern int __builtin_popcount(unsigned int) nogil
@mlauter
mlauter / pyg_traceback.py
Created August 18, 2014 15:00
pygments traceback coloring
import sys
from pygments.style import Style
#from pygments.token import Keyword, Name, Comment, String, Error, Number, Operator, Generic, Token, Whitespace
class BpcTracebackStyle(Style):
default_style = "" #put something here?
styles = {
Comment: 'bold #888',
Keyword: 'bold #005',
Name: '#f00',
@yzhong52
yzhong52 / send_an_email.py
Created May 18, 2014 19:54
Send an email with a gmail account using python 3
# smtplib module send mail
import smtplib
TO = '[email protected]'
SUBJECT = 'TEST MAIL'
TEXT = 'Here is a message from python.'
# Gmail Sign In
gmail_sender = '[email protected]'
@aktau
aktau / imessage
Last active February 25, 2025 15:56
Send iMessage from the commandline
#!/bin/sh
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit
-- another way of waiting until an app is running
on waitUntilRunning(appname, delaytime)
repeat until my appIsRunning(appname)
tell application "Messages" to close window 1
delay delaytime
end repeat
@jiahao
jiahao / setup_julia.sh
Last active January 20, 2022 03:43
Setting up Julia on an Amazon EC2 instance
#Set up data partition
sudo mkdir /data
sudo chmod 777 /data
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab"
sudo mount /data
#Install build environment
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo
sudo yum -y update
sudo yum -y upgrade
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
@zenorocha
zenorocha / README.md
Last active February 10, 2025 07:42
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@toivoh
toivoh / sexpr.jl
Created November 20, 2012 21:06
lispy AST printer and reader
# ---- @sexpr: S-expression to AST conversion ----
is_expr(ex, head::Symbol) = (isa(ex, Expr) && (ex.head == head))
is_expr(ex, head::Symbol, n::Int) = is_expr(ex, head) && length(ex.args) == n
macro sexpr(ex)
esc(sexpr_to_expr(ex))
end
sexpr_to_expr(ex) = expr(:quote, ex)