Weechat Snippet

https://snipt.net/nick/setting-buffers-to-be-indented-under-their-respective-server-buffer-in-weechat/

/set buffers.look.indenting on /set irc.look.server_buffer independent …then for each buffer, switch to it and: /buffer move 1 …where 1 is the position you want to move the buffer (or you can do this w/ mouse if you have that setup) Once buffers are where you want them: /layout save

Apache does support name-based vhosts over SSL.

http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#vhosts

Name-Based Virtual Hosting is a very popular method of identifying different virtual hosts. It allows you to use the same IP address and the same port number for many different sites. When people move on to SSL, it seems natural to assume that the same method can be used to have lots of different SSL virtual hosts on the same server. It is possible, but only if using a 2.2.12 or later web server, built with 0.9.8j or later OpenSSL. This is because it requires a feature that only the most recent revisions of the SSL specification added, called Server Name Indication (SNI).

http://www.codealpha.net/631/name-based-virtual-hosts-with-ssl-using-apache2-on-ubuntu-lucid/

C++ For Dummies - Chapter 5: NestedDemo rewritten in Python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// NestedDemo - input a series of numbers.
// Continue to accumulate the sum
// of these numbers until the user
// enters a 0. Repeat the process
// until the sum is 0.
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// the outer loop
cout << "This program sums multiple seriesn"
<< "of numbers. Terminate each sequencen"
<< "by entering a negative number.n"
<< "Terminate the series by entering twon"
<< "negative numbers in a rown";
// continue to accumulate sequences
int accumulator;
for(;;)
{
// start entering the next sequence
// of numbers
accumulator = 0;
cout << "Start the next sequencen";
// loop forever
for(;;)
{
// fetch another number
int nValue = 0;
cout << "Enter next number: ";
cin >> nValue;
// if it's negative...
if (nValue < 0)
{
// ...then exit
break;
}
// ...otherwise add the number to the
// accumulator
accumulator += nValue;
}
// exit the loop if the total accumulated is 0
if (accumulator == 0)
{
break;
}
// output the accumulated result and start over
cout << "The total for this sequence is "
<< accumulator
<< endl << endl;
}
// we're about to quit
cout << "Thank you" << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/python
print "This program sums multiple seriesnof numbers. Terminate each sequencenb
y entering a negative number.nTerminate the series by entering twonnegative nu
mbers in a row"
def sumSequence():
negative = True
sum = 0
while negative == True:
inputnumber = int(raw_input("Enter next number: "))
if inputnumber >= 0:
sum += inputnumber
else:
negative = False
return sum
def startSum():
returnZero = True
while returnZero == True:
print "Start the next sequence"
u = sumSequence()
if u > 0:
print "The total for this sequence is "+str(u)
else:
returnZero = False
print "Thank you"
startSum()
raw_input()
#Transfusion's rewriting

This must hold great potential and I'm amazed because it looks amazing

http://www-inst.eecs.berkeley.edu/~cs150/sp10/Collections/Papers/nehalemFPGA.pdf http://research.microsoft.com/en-us/projects/BEE3/

The Problem: Computer Architecture is increasingly incremental, and boring. Many papers study a tiny feature, and report 5% improvements. Simulation is too slow to allow full-system experiments running real software. Researchers can no longer build real chips to test new ideas – it’s too expensive. Our Goal: Change this.

Python snippet that splits a target file into chunks.

1
2
3
4
5
6
7
8
9
10
11
$ python testsplit.py -h
usage: testsplit.py [-h] -f FILESPLIT -c CHUNKS
File Splitting by Transfusion
optional arguments:
-h, --help show this help message and exit
-f FILESPLIT, --filesplit FILESPLIT
File, in current directory or entire path
-c CHUNKS, --chunks CHUNKS
Size of each Chunk in MB

py2 code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import sys
import argparse
parser = argparse.ArgumentParser(description='File Splitting by Transfusion')
parser.add_argument('-f','--filesplit', help='File, in current directory or entire path', required=True)
parser.add_argument('-c','--chunks', type=int, help='Size of each Chunk in MB', required=True)
args = vars(parser.parse_args())
def splitFile(inputFile, chunkSizeMB):
chunkSize = int(chunkSizeMB)*1048576
    #read the contents of the file
    f = open(inputFile, 'rb')
    data = f.read() # read the entire content of the file
    f.close()
    # get the length of data, ie size of the input file in bytes
    bytes = len(data)
    print bytes
    #calculate the number of chunks to be created
    noOfChunks = bytes/chunkSize
    if(bytes%chunkSize):
    noOfChunks+=1
    #create a info.txt file for writing metadata
    f = open(os.path.splitext(inputFile)[0]+'-info.txt', 'w')
    f.write(inputFile+','+'chunk,'+str(noOfChunks)+','+str(chunkSize))
    f.close()
    chunkNames = []
    for i in range(0, bytes+1, chunkSize):
    fn1 = os.path.splitext(inputFile)[0]+"ChunkByte%s" % i
    chunkNames.append(fn1)
    f = open(fn1, 'wb')
    f.write(data[i:i + chunkSize])
    f.close()
#try:
# with open(sys.argv[1]): pass
#except IOError:
# print 'Not a valid file.'
#if isinstance(int(sys.argv[2]),(int, long)) == False:
# print 'Please enter the filesize in MB, without using the letters MB'
splitFile(args['filesplit'], args['chunks'])

use 2to3 to convert to py3 code demo:

1
2
3
4
5
6
$ ls -lah
total 21M
drwxrwxr-x 2 transfusion transfusion 4.0K Sep 24 20:03 .
drwxr-xr-x 31 transfusion transfusion 4.0K Sep 24 19:13 ..
-rw-rw-r-- 1 transfusion transfusion 10M Dec 5 2005 10mb.test
-rwxrwxr-x 1 transfusion transfusion 1.5K Sep 24 19:38 filesplit.py
1
2
$ python filesplit.py -f 10mb.test -c 4
10485760
1
2
3
4
5
6
7
8
9
10
$ ls -la
total 20504
drwxrwxr-x 2 transfusion transfusion 4096 Sep 24 20:03 .
drwxr-xr-x 31 transfusion transfusion 4096 Sep 24 19:13 ..
-rw-rw-r-- 1 transfusion transfusion 4194304 Sep 24 20:03 10mbChunkByte0
-rw-rw-r-- 1 transfusion transfusion 4194304 Sep 24 20:03 10mbChunkByte4194304
-rw-rw-r-- 1 transfusion transfusion 2097152 Sep 24 20:03 10mbChunkByte8388608
-rw-rw-r-- 1 transfusion transfusion 25 Sep 24 20:03 10mb-info.txt
-rw-rw-r-- 1 transfusion transfusion 10485760 Dec 5 2005 10mb.test
-rwxrwxr-x 1 transfusion transfusion 1488 Sep 24 19:38 filesplit.py
1
2
$ cat 10mb-info.txt
10mb.test,chunk,3,4194304
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×