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 <sysfs/libsysfs.h> | |
#include <stdio.h> | |
/** | |
* @brief Lists all the devices in the given class. | |
* | |
* @param className Name of the class (in /sys/class). | |
*/ | |
void sysFsListDevices(char *className) | |
{ |
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 <math.h> | |
int main() | |
{ | |
int result; | |
double x; | |
int i; | |
for (i=-100;i<101;i++) |
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/bash | |
TEMP_DIR=`mktemp -d` | |
# Show counter if number of files is greater than this | |
COUNTER_VISIBLE=1 | |
COMPANY="" | |
SCRIPT=`basename $0` | |
EXCLUDE_FILE="" # Name of exclude list file |
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 | |
for CHANGEFILE in *.changes; | |
do | |
str=`echo $CHANGEFILE | grep -v "source.changes"` | |
if [ -z "$str" ]; then | |
continue | |
fi | |
found="0" | |
while read line | |
do |
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
#!/usr/bin/ruby -d | |
#### | |
# | |
# create_unhashed_links.rb | |
# | |
# Creates links that are unhashed to the Gitorious repositories. | |
# Helps link the repositories to Redmine. | |
# | |
# Spaces in project names are replaced with underscores. |
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
#!/usr/bin/perl | |
# This script takes something like this as input: | |
# ID WorkId Date | |
# 1 2 12-10-2009 | |
# 2 16 01-01-2008</pre> | |
# And prints out this: | |
#+-----+----------+---------------+ | |
#|ID |WorkId |Date | |
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
/** | |
* Reads audio devices from ALSA interface and returns count and array of | |
* strings containing the devices. | |
* | |
* @param[out] count Number of devices found. | |
* @param[out] Array of strings containing the device names. | |
* | |
*/ | |
static void getALSADevices(int *count, char **devices) | |
{ |
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
#!/usr/bin/perl | |
my $byte_num = 0; | |
my @vals; | |
while(<>) | |
{ | |
chomp; | |
$vals[$byte_num] = unpack('c', pack 's', hex($_)); | |
$byte_num++; |
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
private void initDb(String db, String user, String pw) { | |
String url = "jdbc:mysql://localhost/" + db; | |
try { | |
Class.forName("com.mysql.jdbc.Driver").newInstance(); | |
con = DriverManager.getConnection(url, user, pw); | |
if (con.isClosed()) { | |
System.err.println("Failed to connecto to " + db); | |
} | |
} |
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 java.util.regex.*; | |
/** | |
* @brief This class is used to verify that input is a valid ISBN (International | |
* Standard Book Number). | |
* | |
* @note Invalid ISBN-13 codes have been published in books! Do not assume | |
* that just because this returns false for an existing ISBN, there is a bug. | |
* Verify with e.g. Amazon that the ISBN is correct first. | |
* |
OlderNewer