Centroid.EU Blog
(this blog is mostly encrypted - adults only)
|
Previous Page
October 27th, 2009
Hackepedia is back online after about
a month of downtime.
0 comments
New features at WildcardDNS
October 25th, 2009
Someone asked if round-robin'ing was possible in wildcarddnsd. The feature
was there once so there was still stub-code but it didn't work. I cleaned
that up today and it seems to work. It makes wildcarddnsd a bit slower
because the zones have to be written after every lookup, but otherwise
NS, A and AAAA records do a wildcard round-robin now.
It's not in the repo HEAD yet but if you check out the ROUNDROBIN branch
the code is added on to BETA_2.
0 comments
Thanks OpenBSD
October 25th, 2009
Theo de Raadt added my name to the list of people who do donations on their
donations page. The list is quite large by now, and I always wondered why
I wasn't added before. It turns out that if your donations accumulate to a
certain amount (100 dollars CA or so) they put your name on the list. This
is nice, it's a nice self-endorsement and it shows my passion for OpenBSD.
0 comments
OpenBSD 4.6 released
October 19th, 2009
OpenBSD 4.6 was released
yesterday. I'm gonna have fun with this.
I just made a 15 euro bank donation to OpenBSD (which is 23 canadian dollars).
I'm doing this in lieu of buying the CD's, but I'm looking forward to perhaps
getting 4.8 on CD next year.
0 comments
2 letter .de domains
October 17th, 2009
On October 23rd starting at 9AM CEST, DENIC will open registrations for
two letter .de domains. Other than saving bandwidth and being rare there
is nothing special about 2 letter .de domains. There is 676 of them if
you exclude numbers. Here
is the story (in german) about this at heise.de.
Joker.com has pre-registrations on the 19th of
October.
0 comments
Sphere.C
October 6th, 2009
Yesterday I came across some formulas which I haven't used in more than a decade
and I made a program out of them, here is what the input and output looks like:
setebos$ ./sphere 1737 # moon
Sphere with radius of 1737.000000
AREA = 37914863.86
VOLUME = 21952706175.03
setebos$ ./sphere 3396 # mars
Sphere with radius of 3396.000000
AREA = 144925640.08
VOLUME = 164055824574.20
setebos$ ./sphere 71492 # jupiter
Sphere with radius of 71492.000000
AREA = 64228053049.52
VOLUME = 1530597322872156.00
And here is the source code including the formula for area and volume of a
sphere:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main(int argc, char *argv[])
{
double volume, radius;
double area;
if (argc != 2) {
fprintf(stderr, "usage: ./sphere [radius]\n");
exit(1);
}
radius = atof(argv[1]);
volume = (4 * M_PI * (pow(radius, 3))) / 3;
area = 4 * M_PI * (pow(radius, 2));
printf("Sphere with radius of %f\n", radius);
printf("AREA = %.2f\n", area);
printf("VOLUME = %.2f\n", volume);
exit(0);
}
0 comments
Compiling and debugging a program
October 6th, 2009
Occasionally I'll post a small C program on this blog. This is how you can
compile it on a UNIX-based computer. Also I add the (-g) compile option
which includes the symbols in the file to make debugging easier. I'm
using this on the program sphere.c which is below, here goes:
setebos$ ls sphere.c
sphere.c
setebos$ cc -g -o sphere sphere.c
/tmp//ccnSRGuU.o(.text+0x66): In function `main':
/usr/home/pjp/src/math/sphere.c:18: undefined reference to `pow'
/tmp//ccnSRGuU.o(.text+0x93):/usr/home/pjp/src/math/sphere.c:19: undefined reference to `pow'
collect2: ld returned 1 exit status
setebos$ cc -g -o sphere sphere.c -lm
setebos$ gdb -silent ./sphere
(gdb) list
2 #include <stdlib.h>
3 #include <math.h>
4
5 int
6 main(int argc, char *argv[])
7 {
8 double volume, radius;
9 double area;
10
11 if (argc != 2) {
(gdb) just press enter here
12 fprintf(stderr, "usage: ./sphere [radius]\n");
13 exit(1);
14 }
15
16 radius = atof(argv[1]);
17
18 volume = (4 * M_PI * (pow(radius, 3))) / 3;
19 area = 4 * M_PI * (pow(radius, 2));
20
21 printf("Sphere with radius of %f\n", radius);
(gdb) break 17
Breakpoint 1 at 0x1c0007df: file sphere.c, line 17.
(gdb) run 10
Starting program: /usr/home/pjp/src/math/sphere 10
Breakpoint 1, main (argc=2, argv=0xcfbfb9bc) at sphere.c:18
18 volume = (4 * M_PI * (pow(radius, 3))) / 3;
(gdb) print radius
$1 = 10
(gdb) n
19 area = 4 * M_PI * (pow(radius, 2));
(gdb) print volume
$2 = 4188.7902047863909
(gdb) n
21 printf("Sphere with radius of %f\n", radius);
(gdb) print area
$3 = 1256.6370614359173
(gdb) continue
Continuing.
Sphere with radius of 10.000000
AREA = 1256.64
VOLUME = 4188.79
Program exited normally.
(gdb) quit
setebos$
0 comments
Alphabetical Countup
September 28th, 2009
Someone on IRC needed a program that counts the alphabetical characters in
words and adds their value. So the value of A would be 1, the value of B
would be 2 and "AB" would be 3 (1 + 2). I wrote this program for him:
#include <stdio.h>
#include <ctype.h>
int
main(int argc, char *argv[])
{
int i;
char *p;
if (argc != 2) {
fprintf(stderr, "usage: name [name]\n");
exit(1);
}
p = argv[1];
i = 0;
while (*p) {
i += (tolower(*p) - 'a') + 1;
p++;
}
printf("the number of name %s is %d\n", argv[1], i);
exit(0);
}
With counting up names and words one can see which ones are similar in
value. Here are some examples:
Peter J. Philipp - Bermuda T. Triangle
Peter - daemonic, Titan, Zion, Yahoo, angelical
pbug - Pete, hacker, airhead, Bobby
centroid - demihuman, demonlike
solarscale - equinox, bridgekeeper, clockroom
I made a file called num2words.txt on the public download that has 234,000
words or so sorted to their respective alphabetic countup. The processing
time it took on my home computer was roughly 2 hours. Because I didn't
make the program efficient it took this long.
Here is a super quick awk statement that makes creating the wordlist super
fast:
awk 'BEGIN { for (i = 65; i < 91; ++i) { c = sprintf("%c", i); h[c] = \
h[tolower(c)] = i - 64 } } { tot = 0; for (i = 1; i <= length(); ++i) \
tot += h[substr($0, i, 1)]; print tot, $0 }' /usr/share/dict/words | \
sort -n
Thanks goes to Figz for making this.
0 comments
Random Hackepedia
September 26th, 2009
Hackepedia is down so I'm going give you a link to
BSS on my hackepedia backups.
0 comments
Next Page
|
Search
RSS Feed
Click here for RSS
On this day in
Other links
Have feedback?
By clicking on the header of an article you will be
served a cookie. If you do not agree to this do not
click on the header. Thanks!
Using a text-based webbrowser?
... such as lynx? Welcome back it's working again for the time being.
Older Blog Entries
November, 2023
October, 2023
September, 2023
August, 2023
July, 2023
June, 2023
May, 2023
April, 2023
March, 2023
February, 2023
January, 2023
December, 2022
November, 2022
October, 2022
September, 2022
August, 2022
July, 2022
June, 2022
May, 2022
April, 2022
March, 2022
February, 2022
January, 2022
December, 2021
November, 2021
October, 2021
September, 2021
March, 2021
February, 2021
January, 2021
December, 2020
November, 2020
October, 2020
September, 2020
August, 2020
July, 2020
June, 2020
May, 2020
April, 2020
March, 2020
February, 2020
January, 2020
December, 2019
November, 2019
October, 2019
September, 2019
August, 2019
July, 2019
June, 2019
May, 2019
April, 2019
March, 2019
February, 2019
January, 2019
December, 2018
November, 2018
October, 2018
September, 2018
August, 2018
July, 2018
June, 2018
May, 2018
April, 2018
March, 2018
February, 2018
January, 2018
December, 2017
November, 2017
October, 2017
September, 2017
August, 2017
July, 2017
June, 2017
May, 2017
April, 2017
March, 2017
February, 2017
January, 2017
December, 2016
November, 2016
October, 2016
September, 2016
August, 2016
July, 2016
June, 2016
May, 2016
April, 2016
March, 2016
February, 2016
January, 2016
December, 2015
November, 2015
October, 2015
September, 2015
August, 2015
July, 2015
June, 2015
May, 2015
April, 2015
March, 2015
February, 2015
January, 2015
December, 2014
November, 2014
October, 2014
September, 2014
August, 2014
July, 2014
June, 2014
May, 2014
April, 2014
March, 2014
February, 2014
January, 2014
December, 2013
November, 2013
October, 2013
September, 2013
August, 2013
July, 2013
June, 2013
May, 2013
April, 2013
March, 2013
February, 2013
January, 2013
December, 2012
November, 2012
October, 2012
September, 2012
August, 2012
July, 2012
June, 2012
May, 2012
April, 2012
March, 2012
February, 2012
January, 2012
December, 2011
November, 2011
October, 2011
September, 2011
August, 2011
July, 2011
June, 2011
May, 2011
April, 2011
March, 2011
February, 2011
January, 2011
December, 2010
November, 2010
October, 2010
September, 2010
August, 2010
July, 2010
June, 2010
May, 2010
April, 2010
March, 2010
February, 2010
January, 2010
December, 2009
November, 2009
October, 2009
September, 2009
August, 2009
July, 2009
June, 2009
May, 2009
Powered by BCHS
|