Skip to content

Instantly share code, notes, and snippets.

import sys, math, pygame
class Point3D():
def __init__(self, x=0, y=0, z=0):
self.x, self.y, self.z = float(x), float(y), float(z)
def rotateX(self, angle):
""" Rotates the point around the X axis by the given angle in degrees. """
rad = angle * math.pi / 180
@kylelk
kylelk / diff_test.py
Created April 25, 2016 00:21
python difflib example
import difflib
# output
# the(insert " fast and") quick brown (replace "fox" with "duck") jumped over the lazy (replace "dog" with "cat")
s1 = 'the quick brown fox jumped over the lazy dog'
s2 = 'the fast and quick brown duck jumped over the lazy cat'
def show_diff(seqm):
@kylelk
kylelk / redis_client.adb
Last active April 22, 2016 01:47
How to connect to a Redis server using Ada
with GNAT.Sockets;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with Ada.Streams; use Ada.Streams;
procedure Redis_Client is
package TIO renames Ada.Text_IO;
package UBS renames Ada.Strings.Unbounded;
Host : constant String := "127.0.0.1";
diff --cc app/views/landing_page/index.html.erb
index 049ff5f,4f1c60f..0000000
--- a/app/views/landing_page/index.html.erb
+++ b/app/views/landing_page/index.html.erb
@@@ -9,7 -9,72 +9,77 @@@
</div>
</div>
-->
-
<div class="main-landing-content">
@kylelk
kylelk / popcount.c
Created October 16, 2015 02:12
sqlite extension to calculate population bit count
/* compile osx
* gcc -bundle -fPIC -O3 -o popcount.dylib popcount.c
* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
with Ada.Text_IO;
use Ada;
procedure name_test is
type Person is record
firstName, lastName : String (1 .. 20);
nameLength : Natural;
end record;
procedure get_person(person_info: out Person) is

Keybase proof

I hereby claim:

  • I am kylelk on github.
  • I am kerseykyle (https://keybase.io/kerseykyle) on keybase.
  • I have a public key whose fingerprint is 88C2 AAE6 B60E DC1A F578 53A3 7277 BEC6 36F3 404F

To claim this, I am signing this object:

@kylelk
kylelk / compute_similar.c
Created July 7, 2015 21:35
finds similar images
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
/* how many images to load at a time */
#define BLOCK_SIZE 1024
/* structure to hold image data */
struct image {
@kylelk
kylelk / add.s
Created May 9, 2015 02:14
add two numbers in ARM assembly
.text
.equ inputBufferSize, 100
.global main
main:
ldr r0, =inputString
bl get_input
bl parseNumber
ldr r1, =number1
str r0, [r1]
@kylelk
kylelk / pop_count.s
Created May 7, 2015 03:17
ARM assembly population count using NEON instructions. compile with: gcc -mfpu=neon pop_count.s
.text
.global main
main:
ldr r0, =value
ldr r0, [r0]
vmov.32 d0[0], r0
vcnt.8 d0, d0
vmov.32 r0, d0[0]
add r0, r0, r0, lsr #16