Skip to content

Instantly share code, notes, and snippets.

/* Frequency of words
*
* This program reads the standard input,
* counts word frequencies
* and output them in a list sorted by frequencies.
*
* Author: Andreas Abel, andreas.abel@ifi.lmu.de
* This code is placed in the public domain.
* Do with it what you like, but leave my name in it.
*/
@kylelk
kylelk / hello2.asm
Created September 28, 2013 00:33
hello world in x86 for mac osx
section .text
global _start
_syscall:
int 0x80
ret
_start:
push dword len
@kylelk
kylelk / jpegdump.c
Created September 27, 2013 00:32
says where parts of a jpeg are
/*
avidump.c
simple format info and dump utility for jpeg codestreams
Copyright (C) 2006 Ralph Giles. All rights reserved.
Distributed under the terms of the GNU GPL.
See http://www.gnu.org/ for details.
*/
@kylelk
kylelk / xgcd.c
Created September 25, 2013 01:03
Extended Euclidean Algorithm in C
/* \begin{verbatim}
/* -------------------------------------------------------------
Module: xgcd.c
Description:
Extended Euclidean Algorithm
finding the greatest common divisor
@kylelk
kylelk / hello-world-address.c
Created September 24, 2013 07:26
addresses of hello world
//h = 0x68
//e = 0x65
//l = 0x6c
//l = 0x6c
//o = 0x6f
// = 0x20
//w = 0x77
//o = 0x6f
//r = 0x72
//l = 0x6c
/* nccolour.c - Print out some ncurses colours.
*
* Compile using:
* gcc nccolour.c -o nccolour -lncurses
*
* Written by Yoran Heling <projects@yorhel.nl>
*
* Date: 2011-06-11
* License: MIT
* Web: http://dev.yorhel.nl/dump/nccolour
import java.security.*;
public class Test {
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchProviderException {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(512);
byte[] publicKey = keyGen.genKeyPair().getPublic().getEncoded();
StringBuffer retString = new StringBuffer();
for (int i = 0; i < publicKey.length; ++i) {
retString.append(Integer.toHexString(0x0100 + (publicKey[i] & 0x00FF)).substring(1));
}
@kylelk
kylelk / content
Created September 21, 2013 20:18
https://github.com/oNaiPs/droid-VNC-server
@kylelk
kylelk / triangle.c
Created September 18, 2013 07:09
triangle
#include <stdio.h>
void pascaltriangle(unsigned int n)
{
unsigned int c, i, j, k;
for (i = 0; i < n; i++)
{
c = 1;
for (j = 1; j <= 2 * (n - 1 - i); j++)
@kylelk
kylelk / socket.c
Created September 18, 2013 06:49
create a simple socket.
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
const char *msg = "hello socket world";
int main()
{