This file contains hidden or 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
| // out must be cb_b642bytes_outsize(sizeof(in)-1) aka cb_b642bytes_outsize(strlen(in)) | |
| // returns length of out, (which *may* be zero-padded) if return val > cb_b642bytes_outsize | |
| static inline int cb_b642bytes_outsize(int insize) { return ((insize-insize%4)+(insize%4==0?0:4))/4*3; } | |
| int cb_b642bytes(unsigned char *out, const char *in); | |
| // out must be cb_bytes2b64_outsize(sizeof(in)) | |
| // returns null-terminated string | |
| static inline int cb_bytes2b64_outsize(int insize) { return ((insize-insize%3)+(insize%3==0?0:3))/3*4+1; } | |
| void cb_bytes2b64(char *out, const unsigned char *in, int in_length); |
This file contains hidden or 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 <sodium/crypto_box.h> | |
| #include <sodium/randombytes.h> | |
| int main(int argc, char *argv[]) { | |
| // payload | |
| unsigned char payload[] = "Hello world, this is a test payload to test NaCl's cipher."; | |
| unsigned char payload_padded[crypto_box_ZEROBYTES + sizeof(payload)] = {0}; | |
| for (int i = 0; i < sizeof(payload); i++) |
This file contains hidden or 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
| .comment p, .comment + p { | |
| line-height: 16px; | |
| } | |
| .comment u, .comment u a, .comment u a:visited, .comment + p u, .comment + p u a, .comment + p u a:visited { | |
| color: #777; | |
| text-decoration: none ; | |
| } | |
| .pagetop { |
This file contains hidden or 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
| [eye ~/Desktop•dotfiles]$ cat HelloWorldClient.java | |
| // | |
| // Hello World client in Java | |
| // Connects REQ socket to tcp://localhost:5555 | |
| // Sends "Hello" to server, expects "World" back | |
| // | |
| // Naveen Chawla <[email protected]> | |
| // | |
| import org.zeromq.ZMQ; |
This file contains hidden or 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
| Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
| /home/kenneth/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb | |
| checking for zmq.h... yes | |
| checking for zmq_init() in -lzmq... yes | |
| Cool, I found your zmq install... | |
| creating Makefile | |
| make | |
| compiling rbzmq.c |
This file contains hidden or 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
| javascript:%24(%22%23mw-page-base%2C%20%23mw-head-base%2C%20%23content%2C%20%23mw-head%2C%20%23mw-panel%2C%20%23footer%22).css(%22display%22%2C%22inherit%22)%3B%24(%22%23mw-sopaOverlay%22).css(%22display%22%2C%22none%22) |
This file contains hidden or 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
| require 'chartboost' | |
| connection = Chartboost::ApiConnection.new | |
| connection.app_id = my_app_id | |
| connection.app_signature = my_app_secret | |
| request = Chartboost::ApiRequest.new | |
| request.controller = :api | |
| request.action = :install |
This file contains hidden or 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 "NSInvocation+ForwardedConstruction.h" | |
| void linkToMyCategoryProperly(void); | |
| void linkToMyCategoryProperly() { | |
| emptyCFunctionToForceLinkerToIncludeNSInvocationForwardedConstruction(); // make sure it's linked to properly | |
| } | |
| // [...] |
This file contains hidden or 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
| <?php | |
| // Adapted by Kenneth Ballenegger | |
| // From php.net | |
| function arguments ($args) { | |
| array_shift($args); | |
| $endofoptions = false; | |
| $ret = array( |
This file contains hidden or 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
| <?php | |
| function xor_cipher($data, $key) { | |
| $data = bitify($data); | |
| $key = bitify($key); | |
| $cipher = array(); | |
| $k_i = 0; | |
| for($d_i=0; $d_i<count($data); $d_i++) { | |
| $d = $data[$d_i]; | |
| $k = $key[$k_i]; |