venable dot devin at gmail dot com
apt-get install libapache2-mod-mono mono-apache-server2
<%@ WebService Language="c#" Codebehind="TestService.asmx.cs" Class="WebServiceTests.TestService" %> using System; using System.Web.Services; using System.Web.Services.Protocols; namespace WebServiceTests { public class TestService : System.Web.Services.WebService { [WebMethod] public string Echo (string a) { return a; } [WebMethod] public int Add (int a, int b) { return a + b; } } }
yum install mod_mono xsp mono-web
AddType application/x-asp-net .aspx
AddType application/x-asp-net .asmx
AddType application/x-asp-net .ashx
AddType application/x-asp-net .asax
AddType application/x-asp-net .ascx
AddType application/x-asp-net .soap
AddType application/x-asp-net .rem
AddType application/x-asp-net .axd
AddType application/x-asp-net .cs
AddType application/x-asp-net .config
AddType application/x-asp-net .Config
AddType application/x-asp-net .dll
AddType application/x-asp-net .asp
DirectoryIndex index.aspx
DirectoryIndex Default.aspx
DirectoryIndex default.aspx
Alias /demo /usr/lib64/xsp/test
MonoApplications "/demo:/usr/lib64/xsp/test"
MonoServerPath /usr/bin/mod-mono-server
chcon -t httpd_sys_content_t '/usr/bin/mono'
module mymono 1.0; require { type lib_t; type tmp_t; type mono_exec_t; type httpd_t; type httpd_sys_script_t; class process ptrace; class sock_file { write create }; class sem create; class file { read execute_no_trans }; } #============= httpd_sys_script_t ============== allow httpd_sys_script_t self:sem create; #============= httpd_t ============== allow httpd_t lib_t:file execute_no_trans; allow httpd_t mono_exec_t:file { read execute_no_trans }; allow httpd_t self:process ptrace; allow httpd_t tmp_t:sock_file { write create };
Feb 8 08:43:32 carbon setroubleshoot: SELinux is preventing the mono from using potentially mislabeled files (mod_mono_server_global). For complete SELinux messages. run sealert -l a00a5946-cec1-4291-a410-e74c5f96edfd
restorecon -R -v /tmp/.wapi
module mynotify 1.0; require { type httpd_t; type inotifyfs_t; class dir read; } #============= httpd_t ============== allow httpd_t inotifyfs_t:dir read;
restorecon -R -v /tmp/.wapi
chcon -t httpd_sys_content_t '/usr/bin/mono'
H0 = 0 stages 1 to n: Hj = Enc(K, Dj XOR H{j-1}) MAC = Enc(K, Dec(K', Hn))
set m0 72C29C2371CC9BDB #message set m1 65B779B8E8D37B29 set m2 ECC154AA56A8799F set m3 AE2F498F76ED92F2 set pd 8000000000000000 #padding set iv 0000000000000000 #initialisation vector set k0 7962D9ECE03D1ACD #key set k1 4C76089DCE131543 set xx {iv} # setup for mj in {m0} {m1} {m2} {m3} {pd} # for each block including padding set xx `xor {xx} {mj}` # chain set xx `des -k {k0} -c {xx}` #encrypt end set xx `des -k {k1} -d {xx}` #decrypt set xx `des -k {k0} -c {xx}` #encrypt echo {xx} #show result 5F1448EEA8AD90A7
#include openssl/des.h #include memory #include string.h //message + padding const unsigned char msg[40] = { 0x72, 0xC2, 0x9C, 0x23, 0x71, 0xCC, 0x9B, 0xDB, 0x65, 0xB7, 0x79, 0xB8, 0xE8, 0xD3, 0x7B, 0x29, 0xEC, 0xC1, 0x54, 0xAA, 0x56, 0xA8, 0x79, 0x9F, 0xAE, 0x2F, 0x49, 0x8F, 0x76, 0xED, 0x92, 0xF2, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //initialization vector unsigned char iv[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; unsigned char k0[8] = { 0x79, 0x62, 0xD9, 0xEC, 0xE0, 0x3D, 0x1A, 0xCD }; unsigned char k1[8] = { 0x4C, 0x76, 0x08, 0x9D, 0xCE, 0x13, 0x15, 0x43 }; void print_hex(const unsigned char *bs, int n) { for (int i = 0; i < n; i++) printf("%02x", bs[i]); printf("\n"); } void des_ecb_crypt(unsigned char* input, unsigned char* output, int encrypt, unsigned char* key) { des_key_schedule sched; des_set_key((des_cblock *) key, sched); DES_ecb_encrypt((const_DES_cblock *)input, (const_DES_cblock *)output, &sched;, encrypt); } void xor_block(unsigned char* src, unsigned char* dest) { for (int x = 0; x < 8; x++) { src[x] = src[x] ^ dest[x]; } } int main(int argc, char* argv[]) { unsigned char output[8]; unsigned char xx[8]; unsigned char block[8]; int offset = 0; memcpy(xx, iv, 8); // Chain and encrypt 5 8-bit blocks for (int x = 0; x < 5; x++) { memcpy(block, &msg;[offset] , 8); offset+=8; //set xx `xor {xx} {mj}` # chain xor_block(xx, block); //set xx `des -k {k0} -c {xx}` #encrypt des_ecb_crypt(xx, output, DES_ENCRYPT, k0); memcpy(xx, output, 8); } des_ecb_crypt(xx, output, DES_DECRYPT, k1); memcpy(xx, output, 8); des_ecb_crypt(xx, output, DES_ENCRYPT, k0); memcpy(xx, output, 8); print_hex(xx, 8); return 1; }
:set list
:set nolist
:%!xxd
<Directory "/var/www/html/python"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory> <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE hsm.settings PythonDebug On PythonPath "['/home/stuff/src/python', '/home/stuff/src/python/hsm'] + sys.path" </Location>
WSGIScriptAlias / /usr/local/www/wsgi-scripts/hsm.wsgi <Directory /usr/local/www/wsgi-scripts> Order allow,deny Allow from all </Directory>
import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'hsm.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() sys.stdout = sys.stderr
[Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] return query.execute_sql(return_id) [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] File "/usr/lib/python2.4/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] cursor = super(InsertQuery, self).execute_sql(None) [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] cursor.execute(sql, params) [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", line 19, in execute [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] return self.cursor.execute(sql, params) [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] File "/usr/lib/python2.4/site-packages/django/db/backends/sqlite3/base.py", line 193, in execute [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] return Database.Cursor.execute(self, query, params) [Tue Jan 05 11:02:08 2010] [error] [client 10.8.8.62] OperationalError: attempt to write a readonly database
Summary: SELinux is preventing the httpd from using potentially mislabeled files ./sqlite3.db (usr_t). Detailed Description: SELinux has denied the httpd access to potentially mislabeled files ./sqlite3.db. This means that SELinux will not allow httpd to use these files. Many third party apps install html files in directories that SELinux policy cannot predict. These directories have to be labeled with a file context which httpd can access. Allowing Access: If you want to change the file context of ./sqlite3.db so that the httpd daemon can access it, you need to execute it using chcon -t httpd_sys_content_t './sqlite3.db'. You can look at the httpd_selinux man page for additional information.
sudo chcon -R system_u:object_r:httpd_sys_content_t database_folder
apt-get install fluid libmxml-dev libfftw3-3 mffm-fftw-dev libasound2-dev
sudo apt-get install ubuntustudio-audio sudo apt-get install linux-rt
sudo modprobe raw1397 sudo chmod a+rw /dev/raw1394
sudo vim /etc/udev/rules.d/40-permissions.rules # EEE1394 (firewire) devices KERNEL=="raw1394", GROUP="audio"
ls -altr /dev/raw1394 crw-rw---- 1 root video 171, 0 2009-12-24 19:55 /dev/raw1394
dextron@dextron:~$ sudo chgrp audio /dev/raw1394 ls -altr /dev/raw1394 crw-rw---- 1 root audio 171, 0 2009-12-24 19:55 /dev/raw1394
import wave, random, math, numpy noise_output = wave.open('tone.wav', 'w') noise_output.setparams((2, 2, 44100, 0, 'NONE', 'not compressed')) # num of seconds duration = 4 # Hz per second samplerate = 44100 # total number of samples samples = duration * samplerate # pulse per second frequency = 90 # Hz """ The time of one sample is the inverse of the sample rate, and the period is the inverse of the frequency, so the number of samples is also the sample rate divided by the frequency. """ period = samplerate / float(frequency) # in sample points """ This is the phase increment. """ omega = numpy.pi * .2 / period """ Creates the x-axis set with 'period' number of items. numpy.arange(int(period), dtype = numpy.float) produces {0..146}, but since each value is a factor of omega, the transformed set is in the range {0..0.627}. """ xaxis = numpy.arange(int(period), dtype = numpy.float) * omega """ This snippet calculates the sin for each value in xaxis and multiplies that value with 16384. Here we're creating the y-axis data. """ ydata = 16384 * numpy.sin(xaxis) """ If we were to graph the sets now, we would see an inclining sin wave. Resize creates an extended array which repeats the ydata chunk, the result being something that looks a bit more like a saw wave than a sin wave due to the omega calculation. """ signal = numpy.resize(ydata, (samples,)) for i in signal: packed_value = wave.struct.pack('h', i) noise_output.writeframes(packed_value) noise_output.close()
find . -type f | xargs file | grep -v ELF
dvenable@dvenable:~/src$ file bin.exe bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
nmap <C-V> "+gP imap <C-V> <ESC><C-V>i vmap <C-C> "+y
map <C-S> <ESC>:w<CR> imap <C-S> <ESC>:w<CR>
find . -name "*.ksh" -exec sed -i 's/oldtext/newtext/g' {} \;
git status
git diff HEAD^ HEAD filename
git show HEAD
git log filename.py
git diff master index.html
#!/usr/bin/python from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from BeautifulSoup import BeautifulSoup from pygments.lexers import guess_lexer, guess_lexer_for_filename from pygments import highlight from pygments.lexers import get_lexer_by_name, TextLexer from pygments.formatters import HtmlFormatter import re register = template.Library() @stringfilter def tocode(value): try: commentSoup = BeautifulSoup(value) c = commentSoup.findAll('pre') for all in c: brs = all.findAll('br') for item in brs: item.replaceWith('\n') joined = ''.join(all.findAll(text=True)) if all.has_key('class'): lex = get_lexer_by_name(all['class'], stripall=True) else: try: lex = guess_lexer(joined) except: lex = BashSessionLexer formatter = HtmlFormatter(linenos=True, cssclass="source") result = highlight(joined, lex, formatter) all.replaceWith(result) return mark_safe(commentSoup) except: return value register.filter('tocode', tocode)
[dvenable@somecorporateserver ~]$ sudo chcon -R --reference=/var/www/html /usr/share/bugzilla
yum install kvm qemu virt-manager libvirt
modprobe kvm-intel ...or... modprobe kvm-amd
/sbin/lsmod | grep kvm
[root@server ~]# brctl show bridge name bridge id STP enabled interfaces virbr0 8000.000000000000 yes
bridge name bridge id STP enabled interfaces virbr0 8000.000000000000 yes vnet0 8000.000000000000 no
vim /etc/sysconfig/network-scripts/ifcfg-vnet0
DEVICE=vnet0 TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes
brctl addif vnet0 eth0
[root@server ~]# brctl show bridge name bridge id STP enabled interfaces virbr0 8000.000000000000 yes vnet0 8000.003048625732 no eth0
qemu-kvm -hda windisk.img -cdrom winimg.iso -m 1024 -boot d
virt-manager
cd $ORACLE_HOME/bin scp exp me@11gserver:~/temp
scp /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/* me@11gserver:~/temp
export LD_LIBRARY_PATH=.:/usr/lib32:/usr/local/lib32
exp SYSTEM/stuff@11gserver:1521/yeah.stuff.com FILE=export.dmp OWNER=me_the_owner
imp SYSTEM/xx FILE=/home/me/export.dmp FULL=y Import: Release 10.2.0.1.0 - Production on Fri Nov 6 08:32:09 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production IMP-00010: not a valid export file, header failed verification IMP-00000: Import terminated unsuccessfully
head export.dmp
EXPORT:V11.01.00
DSYSTEM
RUSERS
./exp SYSTEM/stuff@11gserver:1521/yeah.stuff.com FILE=export.dmp OWNER=me_the_owner
imp SYSTEM/xx FILE=/home/me/export.dmp FULL=Y ... lots of output here, such as row rejected due to ORACLE error 12899 ... Import terminated successfully with warnings.
# # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own
me@mrroboto:~$ python Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
:filetype filetype detection:ON plugin:ON indent:ON 1,0-1 Top
gg=G
:set tabstop=4 :set shiftwidth=4 :set expandtab :retab