Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# https://raymii.org/s/tutorials/Encrypt_and_decrypt_files_to_public_keys_via_the_OpenSSL_Command_Line.html
# Get the public key
openssl rsa -in certificate.pem -out publickey.pem -outform PEM -pubout
# Generate the random password file
openssl rand -base64 128 -out key.bin
# Encrypt the random key with the public keyfile
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
namespace Tcp
{
#!/usr/bin/python
# http://www.codeproject.com/Articles/43665/ExifLibrary-for-NET
# http://www.exiv2.org/tags.html
# http://www.awaresystems.be/imaging/tiff/tifftags.html
import os
import struct
import random
import datetime
import sys
@realduke2000
realduke2000 / bash.sh
Last active September 22, 2016 09:10
#query scripts in rpm file
rpm -qp --scripts xxx.rpm
#extact files in .rpm file
rpm2cpio myrpmfile.rpm | cpio -idmv
# delete user from ldap
nbur420-332vm1:~ # ldapdelete -v -x -D "cn=admin mgr 01,dc=nbur 420 332 vm1,dc=engba,dc=xxx,dc=com" -w P@ssw0rd "uid=u5_asesxb9k16-vm544,ou=people,dc=nbur 420 332 vm1,dc=engba,dc=xxx,dc=com"
ldap_initialize( <DEFAULT> )
deleting entry "uid=u5_asesxb9k16-vm544,ou=people,dc=nbur 420 332 vm1,dc=engba,dc=xxx,dc=com"
@realduke2000
realduke2000 / proxy.py
Last active August 29, 2015 14:14
quick python http proxy
#!/usr/bin/python
max_data_len = 1024000
import socket, sys
def main(argv):
if len(argv) < 3:
usage()
return
@realduke2000
realduke2000 / gist:5668363
Created May 29, 2013 06:34
Diff two file per byte. Read file and represent as HEX string. Read Hex string, convert to byte and write to file.
public static void DiffPerByte(string path1, string path2)
{
byte[] file1 = System.IO.File.ReadAllBytes(path1);
byte[] file2 = File.ReadAllBytes(path2);
Console.WriteLine("{0} len: {1}", path1, file1.Length);
Console.WriteLine("{0} len: {1}", path2, file2.Length);
int len = file2.Length < file1.Length ? file2.Length : file1.Length;
for (int i = 0; i < len; i++)
{