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
morse = {".-":"A","-...":"B","-.-.":"C","-..":"D",".":"E","..-.":"F","--.":"G","....":"H","..":"I",".---":"J","-.-":"K",".-..":"L","--":"M","-.":"N","---":"O",".--.":"P","--.-":"Q",".-.":"R","...":"S","-":"T","..-":"U","...-":"V",".--":"W","-..-":"X","-.--":"Y","--..":"Z",".----":"1","..---":"2","...--":"3","....-":"4",".....":"5","-....":"6","--...":"7","---..":"8","----.":"9","-----":"0"} | |
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
import math | |
class MeanAndStddev: | |
def __init__(self): | |
self.values = []; | |
def append(self, val): | |
self.values.append(val * 1.0) | |
def mean(self): | |
sumValue = 0 | |
for a in self.values: |
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 "Perceptron.h" | |
#include <math.h> | |
const float c = 0.01; | |
Perceptron::Perceptron(int n) { | |
weights = new float[n]; | |
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
for FILE in *.JPG; do mv $FILE `sha1sum $FILE | sed -e "s/ /_/g"`; done |
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
#!/bin/bash | |
TEMPFILE=/var/tmp/tmptxt | |
DIFF=diffmerge | |
if [ $# -ne 2 ]; then | |
echo "usage:"$0" <REVISION> <FILE>" 1>&2 | |
exit 1 | |
fi |
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
//!(C)tmiz.net | |
#include <stdio.h> | |
#define X86_VENDERNAME_ARRAY_LENGTH 13 | |
#define X86_BRANDNAME_ARRAY_LENGTH 49 | |
extern void GetX86CPUVenderName(char*outVendername); | |
extern void GetX86CPUBrandName(char*brandname); | |
int main() { | |
char vender[X86_VENDERNAME_ARRAY_LENGTH]; |
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
-- Sample Apple Script for SimplyRec + ChromeLauncherWithExtraAudio with Google Chrome | |
-- SimplyRec http://tg.tmiz.net/softwares/sr/index-e.html | |
-- ChromeLauncherWithExtraAudio http://tg.tmiz.net/softwares/clwea/ | |
-- Google Chrome for Mac http://www.google.co.jp/chrome/ | |
-- SoundFlower http://code.google.com/p/soundflower/ | |
-- This scirpt can be executed by iCal and Automator, Apple Script Editor | |
-- Please select input device "SoundFlower" on SimplyRec before executing. | |
tell application "ChromeLauncherWithExtraAudio" |
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> | |
#define ELEMENTSNUM (sizeof(array) / sizeof(array[0])) | |
int array[] = {10,20,30,40,50,60,70}; | |
int main() | |
{ | |
int d; | |
for(d=-1;d <= (ELEMENTSNUM-2);d++) | |
printf("%d\n",array[d+1]); | |
return 0; | |
} |
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> | |
int main() { | |
if ((int) -1 < (unsigned int) 5) { | |
printf("(A)\n"); | |
} else { | |
printf("(B)\n"); | |
} | |
return 0; | |
} | |
// Which is output? |
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 <time.h> | |
struct mydate { int year,month,day; }; | |
int addDay(struct mydate *d, int n) | |
{ | |
struct tm birthday = {0,0,0,d->day,d->month,d->year-1900,0,0,0,0,NULL}; | |
time_t birthday_sec = mktime(&birthday); | |
birthday_sec += (n*24*60*60); | |
struct tm *pHA = localtime( &birthday_sec ); |
OlderNewer