This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtGui> | |
using namespace std; | |
class Sample : public QObject { | |
Q_OBJECT | |
public slots: | |
void action() { | |
emit quitApplication(); | |
} | |
signals: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.spec.AlgorithmParameterSpec; | |
import javax.crypto.Cipher; | |
import javax.crypto.spec.SecretKeySpec; | |
import javax.crypto.spec.IvParameterSpec; | |
class CryptAES { | |
static final String cipher_type = "AES/CBC/PKCS5Padding"; | |
public static void main(String[] args) { | |
String key = args[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <event.h> | |
#define BUFSIZE 256 | |
#define TIMEOUT_SEC 3 | |
void read_handler(int fd, short event, void *arg) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var streams = new Array(); | |
var server = net.createServer(function(stream) { | |
stream.setEncoding('utf8'); | |
stream.on('connect', function() { | |
stream.write('Welcome\r\n'); | |
streams.unshift(stream); | |
}); | |
stream.on('data', function(data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <openssl/evp.h> | |
char *encrypt(const char *data, const char *key, const char *iv, int *length) | |
{ | |
int key_length, iv_length, data_length; | |
key_length = strlen(key); | |
iv_length = strlen(iv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* gcc -std=c99 crypto.m -framework Foundation | |
*/ | |
#import <Foundation/Foundation.h> | |
#import <CommonCrypto/CommonCryptor.h> | |
@interface NSData (AES) | |
- (NSData *)AES128Operation:(CCOperation)operation key:(NSString *)key iv:(NSString *)iv; | |
- (NSData *)AES128EncryptWithKey:(NSString *)key iv:(NSString *)iv; | |
- (NSData *)AES128DecryptWithKey:(NSString *)key iv:(NSString *)iv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <openssl/evp.h> | |
int main(int argc, const char* argv[]) | |
{ | |
if (argc <= 3) { | |
fprintf(stderr, "Usage: %s <key> <iv> <data>\n", argv[0]); | |
exit(EXIT_FAILURE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <openssl/evp.h> | |
int main(int argc, const char* argv[]) | |
{ | |
if (argc <= 3) { | |
fprintf(stderr, "Usage: %s <key> <iv> <data>\n", argv[0]); | |
exit(EXIT_FAILURE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Description: | |
# Disable the localization of directory' name in Mac OS X. | |
# | |
use strict; | |
use warnings; | |
my $home = $ENV{'HOME'}; | |
my @directories = ( | |
"$home/Desktop", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <event2/event.h> | |
#include <event2/bufferevent.h> | |
#define PORT 1986 | |
#define BACKLOG 1000 | |
void readcb(struct bufferevent *bufev, void *arg) |