Blog
Method one
Method two
Method three
openssl aes-256-cbc -salt -in secrets.txt -out secrets.txt.enc
openssl aes-256-cbc -d -in secrets.txt.enc -out secrets.txt.new
* You will be prompted for a password.
openssl req -x509 -newkey rsa:1024 -keyout file.pem -out file.crt -days 9999 -nodes
or advanced method
openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr \
-subj '/C=RU/ST=St.Petersburg/L=St.Petersburg/CN=www.4foo.net'
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
make sure you enter right value to CN field
One of common question of python programming is how to do jar equivalent - i.e. run something like python myapp.zip . Below I describe a method producing a close result (hey python team - good place to enhance): unfortunately couple of bugs in python zip handling (e.g. python can't import module from zipfile with comments) make this task a little bit tricky.
- Make sure you app is ready to work with zip bundle i.e. file is replaced to ZipFile when necessary.
- Prepare the entry point:
main.py def __main__(): ....
- create a bundle
zip -r test.zip *.py *.pyc
- create a launcher either shell or pure python one and place it somewhere.
#!/bin/sh mod="$1" shift python -c "import sys; sys.path.insert(0,'${mod}'); import main;main.__main__()" $*import sys sys.path.insert(0,sys.argv[1]) import main main.__main__()enjoy
After dozen of experiments I finally come to next action sequence with gdb as the most universal/reliable one.
set solib-absolute-prefix /home/dms/Sept12/12_09_2008_20_00_node4/D
Notice: set substitute-path doesn't work because gdb apply it to source files only
gdb -x D/gdbrc D/java core
info shared
You will see something like:
(gdb) info shared
From To Syms Read Shared Object Library
No /lib/tls/libpthread.so.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0x00a05bb0 0x00a068c4 Yes /home/dms/Sept12/D/lib/libdl.so.2
...
0x008c9c00 0x009b9800 Yes /home/dms/Sept12/D/lib/tls/libc.so.6
No /lib/libnsl.so.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In my case:
D/lib/tls/lib/tls/libpthread.so.0 D/lib/libnsl.so.1
To gather all libraries necessary to open a coredump on other machine run:
gdb -batch --eval "info shared" D/java core 2> /dev/null |\ sed -n -e 's/^.*Yes[^\/]*\//\//p' -e 's/^.*No[^\/]*\//\//p' > filelist
on your own machine and than:
cat filelist | zip zipme.zip -@
on client one
To do it:
#0 0xffffe424 in __kernel_vsyscall () #1 0xb76f96e0 in raise () from /lib/libc.so.6 #2 0xb76faf15 in abort () from /lib/libc.so.6 #3 0xb70abbaf in os::abort(bool) #4 0xb71de555 in VMError::report_and_die() #5 0xb70b257c in JVM_handle_linux_signal () #6 0xb70ae7a4 in signalHandler(int, siginfo*, void*) () #7 <signal handler called>
Ever without symbols - you should have exactly 6 entries before <> and os::abort is right the next after libc abort.
0xb6bf2bd0 0xb71fe250 Yes (*) /opt/jdk1.6.0_18/jre/lib/i386/server/libjvm.so
<os::abort> - 0x4b8fdf = N, N + 0x60b680
*Calculate offset between your JVM and cu JVM
<os::abort> - 0xb70abbaf (os:abort from my core, or compare two JVM starts)
info address <recalcualted_address>
If you installed windows 10 on old Thinkpad T420 and you realize that neither bluetooth nor wifi are working properly (windows reports that it is turned off and can't turn it on) >do following:
You should be able to use WiFi/Bluetooth now.
xip is an old archive format used to distribute XCode. it's actually an xar format but with ability to be signed. If you installing the same software multiple times and don't want to spend time to verify known to be valid signature, instead of xip -x do the following (you can use xar -x -f instead of bsdtar xvf):
bsdtar xvf Archive.xip
ditto -x Content .
It's often convenient to run jcmd command programmatically from within a testcase to get some information or to adjust options.
See the template below:
// import javax.management.ObjectName;
// import javax.management.MBeanServer;
public static void reloadCompilerDirectives(String filename) {
String result;
result = doRunDcmd("compilerDirectivesClear", new String[]{""});
result = doRunDcmd("compilerDirectivesAdd", new String[]{ filename });
}
private static String doRunDcmd(String operationName, String operationArgs[]) {
ObjectName objectName =
new ObjectName("com.sun.management:type=DiagnosticCommand");
MBeanServer mbeanServer =
ManagementFactory.getPlatformMBeanServer();
Object[] params = new Object[] { operationArgs };
String[] signature = new String[]{ String[].class.getName() };
return(String) mbeanServer.invoke(objectName, operationName, params, signature);
}
It's not always obvious what assembly will be generated after expanding all the macros of the HotSpot meta-assembly system. The following code shows how to print the actual code generated by HotSpot.
// #define DMS_DEBUG
#ifdef DMS_DEBUG
address barrier_start = masm->code()->insts_end();
#endif
__ block_comment("nmethod_barrier begin");
__ ldr_label(tmp0, guard);
...
__ bind(skip);
__ block_comment("nmethod_barrier end");
#ifdef DMS_DEBUG
address barrier_end = masm->code()->insts_end();
tty->print_cr("DMS: barier %p %p bytes: %d", barrier_start, barrier_end, barrier_end - barrier_start);
// masm->code()->print();
masm->code()->decode();
#endif
The following code shows how to organize debug printing with minimal impact on the loaded system
#include <syslog.h>
#include <stdarg.h>
#include <stdlib.h>
static void print_at(const char *srcfile, int line, const char *format, ...) {
va_list ap;
const char *envvar="JAVA_SHOULD_PRINT_AT";
static int requested_line = -1;
if (requested_line == -1) {
const char *should_print = getenv(envvar);
requested_line = (should_print != NULL) ? atoi(should_print) : 0;
openlog("javadebug", LOG_PID, LOG_UUCP);
}
if (requested_line == line) {
va_start(ap, format);
vsyslog(LOG_DEBUG, format, ap);
va_end(ap);
}
}
dvgrab capture_20060604.dv ffmpeg -i capture_20060604.dv -target pal-dvd capture_20060604.mpeg
more ... http://womble.decadent.org.uk/talks/dvd-ukuug06/dvd-talk-ukuug06-paper.html
/opt/mplayer/bin/mencoder infile.mkv -oac copy -ovc copy -o outfile.avi
or using mkvtoolnix
$ mkvinfo movie.mkv |+ Segment tracks | + Track number: 1 ^^^^^^^^^^^^^^^ + Track type: video ^^^^^^^^^^^^^^^^
$ mkvextract tracks "/mnt/common/Film/movie.mkv" 1:/mnt/common/Film/video.h264 2:/mnt/common/Film/audio.aac
$ mencoder -audiofile video.aac -oac copy -ovc copy audio.h264 [-of mpeg] -o movie_complete.mpg
or
$ ffmpeg -i video.h264 -i audio.aac -map 0.0:0 -map 1.0:0 -acodec copy -vcodec copy -r 23.976 -f vob video.mpg
to display cert details