Skip to content

Instantly share code, notes, and snippets.

INCLUDE Irvine32.inc
.data
text DWORD 100 DUP(0), 0 ;text[100], init to 0
.code
main PROC
mov esi, 0 ;int i = 0
L1:
call ReadInt ;scanf("%d", &test[i])
INCLUDE Irvine32.inc
.data
text DWORD 10 DUP(?)
.code
main PROC
mov esi, 0
L1:
TITLE Reversing a String
INCLUDE Irvine32.inc
.data
buffer BYTE 100 DUP(0)
byteCount DWORD ?
.code
main PROC
#!/usr/bin/ruby -w
require 'rubygems'
require 'nokogiri'
require 'open-uri'
$KCODE = 'u'
(50..67).each do |count|
html = open("http://whoswho.openfoundry.org/workshop/details/#{count}") rescue "404 Not Found"
#!/usr/bin/ruby
require 'net/http'
require 'uri'
if ARGV.length < 1 then
puts "Usage: ./paste2plurk.rb [filename] ... "
exit
end
def get_language (filename)
@dannvix
dannvix / main.m
Created December 2, 2010 03:03
iPhone Hello World Application
// copyed from "iPhone Developer's Cookbook", Addison-Wesley 2009
#import <UIKit/UIKit.h>
@interface HelloWorldViewController : UIViewController
@end
@implementation HelloWorldViewController
- (void) loadView
{
@dannvix
dannvix / upload.html.erb
Created February 25, 2011 17:48
Example Rails view with mod_upload_progress
<% uuid = (rand * 1e10).floor %>
<script type="text/javascript">
var timer;
var elapsed;
function update_progress() {
elapsed += 1;
jQuery.ajax({
type: "GET",
url: "/progress",
dataType: "json",
/* 引入 Win32 API 中的 User32.DLL
* 需要加上 using System.Runtime.InteropServices;
*/
[DllImport("user32.dll")]
public static extern Boolean GetWindowRect(IntPtr hWnd, ref Rectangle bounds);
public void CaptureWindow () {
/* 取得目標視窗的 Handle
* 需要加上 using System.Diagnostics;
*/
@dannvix
dannvix / pam_dotp.c
Created April 2, 2011 11:30
Simple Linux PAM module for OTP authentication
#include <security/pam_modules.h>
#include <security/pam_appl.h>
#include <sys/types.h>
#include <gcrypt.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define SERVER_SECRET "MY_SECRET"
void gen_otp (char **otp) {
@dannvix
dannvix / Sobel.rb
Created March 22, 2012 08:10
Sobel filter with RMagick
class Sobel
require 'RMagick'
include Magick
@@kernels = {
:up => [1, 2, 1, 0, 0, 0, -1, -2, -1],
:down => [-1, -2, -1, 0, 0, 0, 1, 2, 1],
:left => [1, 0, -1, 2, 0, -2, 1, 0, -1],
:right => [-1, 0, 1, -2, 0, 2, -1, 0, 1]
}