This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ~/.ipython/profile_default/startup/10-mystartup.py | |
| import numpy as np | |
| ip = get_ipython() | |
| def import_astropy(self, arg): | |
| ip.ex('import astropy') | |
| ip.ex('print(astropy.__version__)') | |
| ip.ex('from astropy.io import ascii') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from ( | |
| -- define the column names | |
| select 0 as a, 0 as b | |
| -- join the definition row with all the values | |
| union | |
| -- define the values | |
| values | |
| (4,5), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // intel CPUID opcode | |
| // see: https://en.wikipedia.org/wiki/CPUID | |
| // clang -Wall -Wextra -std=c11 cpuinfo.c -o cpuinfo | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <cpuid.h> //macro __cpuid(eaxin, eaxout, ebx, ecx, edx) | |
| int main() { | |
| { |