This project has moved to https://github.com/jonhoo/drwmutex so it can be imported into Go applications.
This file contains 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
// This file: https://gist.github.com/macton/4dd5fec2113be284796e | |
// See: Intel Intrinsics Guide https://software.intel.com/sites/landingpage/IntrinsicsGuide/ | |
// See: CPUID Explorer http://www.flounder.com/cpuid_explorer1.htm | |
// See: Playing with cpuid http://newbiz.github.io/cpp/2010/12/20/Playing-with-cpuid.html | |
// See: MSDN __cpuid, __cpuidex http://msdn.microsoft.com/en-us/library/hskdteyh.aspx | |
// See: Notes on MMX/SSE and a searchable table of intrinsics. http://www.taffysoft.com/pages/20120418-01.html | |
// See: AMD CPUID Specification http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/25481.pdf | |
#if defined(__GNUC__) | |
#include <stdint.h> |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <time.h> | |
#include <emmintrin.h> | |
/* | |
* Round up n to the next multiple of m. | |
* m needs to be a power of 2. | |
*/ |
This file contains 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
FROM ubuntu | |
# make sure the package repository is up to date | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get install -y openssh-server | |
RUN mkdir /var/run/sshd | |
# set up root:root and me:me |
This file contains 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
// | |
// How to set timeout for http.Get() in golang | |
// | |
package main | |
import ( | |
"io" | |
"io/ioutil" | |
"log" | |
"net" |
This file contains 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
def image_link(identifier, rep_name) | |
item = @items[identifier] | |
rep = item.rep_named(rep_name) | |
# Create soft dependency | |
# (i.e. when the image changes, this page will be recompiled) | |
Nanoc::NotificationCenter.post(:visit_started, item) | |
Nanoc::NotificationCenter.post(:visit_ended, item) | |
# Create hard dependency |
This file contains 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
nnoremap <silent> y :<C-U>call MarkAndSetOpfunc()<CR>g@ | |
vnoremap <silent> y :<C-U>call MarkYankAndJump()<CR> | |
function! MarkAndSetOpfunc() | |
let g:save_cursor = getpos(".") | |
set opfunc=YankAndJumpBack | |
endfunction | |
function! MarkYankAndJump() | |
let g:save_cursor = getpos(".") |
This file contains 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
#include <stdlib.h> // card > cjs.ppm | |
#include <stdio.h> | |
#include <math.h> | |
typedef int i;typedef float f;struct v{ | |
f x,y,z;v operator+(v r){return v(x+r.x | |
,y+r.y,z+r.z);}v operator*(f r){return | |
v(x*r,y*r,z*r);}f operator%(v r){return | |
x*r.x+y*r.y+z*r.z;}v(){}v operator^(v r | |
){return v(y*r.z-z*r.y,z*r.x-x*r.z,x*r. | |
y-y*r.x);}v(f a,f b,f c){x=a;y=b;z=c;}v |
This file contains 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
add_action( 'wp_enqueue_scripts', 'my_pjn_scripts_and_styles'); | |
function my_pjn_scripts_and_styles() { | |
if ( is_page( 'some-page-slug' ) ) { | |
wp_enqueue_script( | |
$handle = 'googlemap', | |
$src = "http://maps.googleapis.com/maps/api/js?sensor=true", | |
$deps = array(), | |
$ver = 'V3', | |
$in_footer = true |
This file contains 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
/* ========================================================================= | |
CurveZMQ - authentication and confidentiality for 0MQ | |
------------------------------------------------------------------------- | |
Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com> | |
Copyright other contributors as noted in the AUTHORS file. | |
This is free software; you can redistribute it and/or modify it under | |
the terms of the GNU Lesser General Public License as published by | |
the Free Software Foundation; either version 3 of the License, or (at |
NewerOlder