Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Pleiades / twittersharebutton.php
Created November 15, 2012 23:35
Twitter Share button
function twitter( $atts, $content=null ){
/* Author: Nicholas P. Iler
* URL: http://www.ilertech.com/2011/07/add-twitter-share-button-to-wordpress-3-0-with-a-simple-shortcode/
*/
extract(shortcode_atts(array(
'url' => null,
'counturl' => null,
'via' => '',
'text' => '',
'related' => '',
@iLittleSheep
iLittleSheep / gist:4103605
Created November 18, 2012 04:44
python email
# Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
# Open a plain text file for reading. For this example, assume that
# the text file contains only ASCII characters.
fp = open(textfile, 'rb')
# Create a text/plain message
@bellbind
bellbind / tetris-svg.html
Created November 20, 2012 09:22
[javascript][svg]tetris model with svg ui (arrow key control)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<script src="tetris.js"></script>
<script src="tetris-svg.js"></script>
</head>
<body>
<div><svg id="stage"></svg></div>
@xiaoyao1991
xiaoyao1991 / gmail.py
Created November 20, 2012 10:07
Sending email
import smtplib
sendto = ['xxx@xxx.com', 'yyy@yyy.com', 'zzz@zzz.com'] #收件人
no = [1,2,3] #编号
gmail_username = 'youremail@gmail.com'
gmail_password = 'password'
smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
@gin1314
gin1314 / gist:4117125
Created November 20, 2012 10:18
PHP: CI: custom 404 page script
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
define('EXT', '.php');
class MY_Router extends CI_Router {
var $error_controller = 'error';
var $error_method_404 = 'error_404';
function __construct()
{
parent::__construct();
@radaniba
radaniba / parsetree.py
Created November 29, 2012 16:59
A sample script using the ETE package to detect shift in internal nodes where a significant change in enrichment values (could be anything) happens
#A sample script using the ETE package to detect shift in internal nodes where a significant change in enrichment values (could be anything) happens
#An example (using the scipy python module to perform a K-S test):
from scipy import stats
from ete2 import Tree
newick = "((((A, B)edge1, C)edge2, ((D, E)edge3, F)edge4)edge5, (((G, H)edge6, I)edge7, ((J, K)edge8, L)edge9)edge10)RootEdge;"
@radaniba
radaniba / rpkmforgenes.py
Created November 29, 2012 17:17
The python script rpkmforgenes.py is written for calculating gene expression for RNA-Seq data. It was used for a study published in PLoS Computational Biology (Ramsköld D, Wang ET, Burge CB, Sandberg R. An abundance of ubiquitously expressed genes reveale
Sequence data input:
A common input file format is bed file. In the simplest form, it has the format
chromosome -tab- startposition -tab- endposition
where each line corresponds to one sequence read
However this format can also include strand information:
chromosome -tab- startposition -tab- endposition -tab- name -tab- score -tab- +/-
for example:
chr13 54005048 54005081 . 1 -
The score field is ignored.
Files are allowed by have an optional first line starting with "track", this line is then ignored
#!/bin/bash
# This script is modified from the one found here: https://wiki.archlinux.org/index.php/IPv6_-_Tunnel_Broker_Setup
# Noticably this script now runs like this:
# $0 <start|stop> <device name>
#
# So if you want IPv6 traffic to be routed through wlan0, you would do:
# $0 start wlan0
if [ "$EUID" -ne 0 ]; then
@sloria
sloria / bobp-python.md
Last active July 7, 2024 18:13
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens