Skip to content

Instantly share code, notes, and snippets.

@yutopio
yutopio / FileSplitMerge.cs
Last active August 29, 2015 13:55
Splits a large file into smaller files, and merges them back into the original one.
using System;
using System.IO;
class Program
{
const int SplitSize = 1024 * 1024 * 1024; // Splits into 1GB files
const int BufferSize = 1024 * 1024; // using 1MB size buffer
static void Main(string[] args)
{
@yutopio
yutopio / ViewControllerTrack.m
Created November 6, 2014 02:37
Implementation injection
//
// AppDelegate.m
//
// Created by Yuto Takei on 10/8/14.
// Copyright (c) 2014 Yuto Takei. All rights reserved.
//
#import <objc/runtime.h>
#import "AppDelegate.h"
@yutopio
yutopio / FileHash.cs
Last active August 29, 2015 14:13
Obtain MD5 file hash for all files in subdirectories in a specified path.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
static class Program
{
static MD5 md5;
static MemoryStream ms;
static StreamWriter sw;
@yutopio
yutopio / Aes.cs
Last active August 29, 2015 14:14
AES Cryptography Sample
using System;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
class Program
{
static void Main(string[] args)
{
string iv, key;
@yutopio
yutopio / home.html.erb
Last active August 29, 2015 14:19
Shell injection test. DO NOT DEPLOY outside the testing environment.
<h1>Exec</h1>
<%= form_tag(command_exec_url) do %>
<div class="actions">
<%= text_area_tag(:stdin, "", size: "50x20") %>
</div>
<%= submit_tag("Execute") %>
<% end %>
@yutopio
yutopio / Location.cs
Created May 12, 2015 05:42
Google Maps Polyline encoder / decoder.
using System;
public partial struct Location
{
public static readonly Location Empty;
static Location()
{
Empty = new Location { Latitude = 0, Longitude = 0 };
}
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
static class Program
{
static void Main(string[] args)
using System;
using System.IO.Pipes;
using System.IO;
using System.Threading;
using System.Text;
using Microsoft.Win32.SafeHandles;
class Program
{
static PipeStream stream;
#include <iostream>
#include <math.h>
using namespace std;
int StartingAt(int n);
int main()
{
cout << StartingAt(1);
@yutopio
yutopio / sieve.cs
Created May 24, 2013 14:34
Sieve of Eratostheness
using System;
using System.Collections.Generic;
using System.IO;
unsafe class Program
{
static void Main()
{
var start = DateTime.Now;
var fs = new FileStream("prime.txt", FileMode.Create, FileAccess.Write, FileShare.Read);