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
#include <stdio.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main() | |
{ | |
struct flock fl; |
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
/* | |
* This function ensures that there is required amount of data in the | |
* ndr stream. When there isn't, it tries to read as much data as | |
* possible in order to reduce the number of recv() calls. It grows | |
* the stream if necessary. It relies on pdu_size so be careful. | |
*/ | |
static int | |
nds_fetch(int sock, ndr_stream_t *nds, size_t need) | |
{ | |
ssize_t rc; |
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
ac_power() { | |
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings | |
echo 0 > /proc/sys/vm/laptop_mode | |
hdparm -B 128 -S 240 /dev/sda | |
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy | |
echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy | |
echo 1 > /sys/module/snd_hda_intel/parameters/power_save | |
} | |
battery_power() { |
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
template <class T> | |
class RefCounted { | |
public: | |
void incRef() | |
{ | |
m_refcount++; | |
} | |
void decRef() | |
{ |
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
#include <cassert> | |
#include <cstdlib> | |
#include <vector> | |
#include <boost/intrusive_ptr.hpp> | |
#include <AL/al.h> | |
#include <AL/alc.h> | |
#include <vorbis/vorbisfile.h> | |
#include "bicycles/sp.h" |
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
#include "material.h" | |
#include "opengl.h" | |
uint32_t VertexAttrib::convertType(type_t type) | |
{ | |
switch (type) { | |
case FLOAT: | |
return GL_FLOAT; | |
case SHORT: | |
return GL_SHORT; |
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
struct Foo { | |
virtual int bar() = 0; | |
}; | |
struct A : public Foo { | |
int bar() { return 1; } | |
}; | |
struct B : public Foo { | |
int bar() { return 2; } |
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
open OUnit | |
class printable_point x_init = | |
object (s) | |
val mutable x = x_init | |
method get_x = x | |
method move d = x <- x + d | |
method print = string_of_int s#get_x | |
end |
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
template <class T> | |
int ffs(T i) | |
{ | |
T step = sizeof(i)*8 >> 1; | |
int n = 1; | |
for (; step > 1; step >>= 1) { | |
T shift = ((T)1 << step)-1; | |
if (!(i & shift)) { | |
n += step; |
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
{-# LANGUAGE OverloadedStrings #-} | |
import System.IO | |
import Network.Curl | |
import Network.URI | |
import Text.HTML.TagSoup | |
import Text.Printf | |
import Data.Graph.Inductive | |
import qualified Data.Map as M | |
import qualified Data.Set as S | |
import qualified Data.ByteString.Lazy as BS |