Skip to content

Instantly share code, notes, and snippets.

@amatus
amatus / atx2600.120203.txt
Created August 31, 2012 18:11
ATX2600 code-down, 2012-02-03
[ problem 1 ]
Given an arbitrary linked list, can you figure out if a loop occurs. Find
a solution that can be done with O(1) space restriction (constant extra
spaced used). You have no knowledge about the length of the list.
Write an algorithm that solves the problem.
[ problem 2 ]
Given a string, find the first occurrence of a letter that does not repeat.
For example, in the string "abcdab", the answer is 'c' (not 'd'). Try to
find a solution with O(n) time.
@amatus
amatus / IRLZ34N
Created April 27, 2013 14:12
IRLZ34N HEXFET® Power MOSFET
IRLZ34N
HEXFET® Power MOSFET
_____ D
| |
| |<-,
G___| |__|__ S
(reverse diode not shown)
@amatus
amatus / llvm-ar.patch
Created July 14, 2013 02:19
Patch for llvm-ar to create sub-directories correctly.
--- llvm-3.2.src.orig/tools/llvm-ar/llvm-ar.cpp 2012-10-26 05:49:15.000000000 -0500
+++ llvm-3.2.src/tools/llvm-ar/llvm-ar.cpp 2013-07-13 21:17:35.047302973 -0500
@@ -461,11 +461,12 @@
(std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) {
// Make sure the intervening directories are created
- if (I->hasPath()) {
- sys::Path dirs(I->getPath());
- dirs.eraseComponent();
- if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg))
@amatus
amatus / rust_for_rpi.md
Last active February 18, 2017 21:13 — forked from anonymous/gist:6664882
Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

sudo apt-get install git build-essential
test `uname -m` = x86_64 && sudo apt-get install ia32-libs
git clone https://github.com/raspberrypi/tools.git
export PATH=$PWD/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
git clone http://github.com/mozilla/rust.git
cd rust
./configure --target-triples=arm-unknown-linux-gnueabihf

make

@amatus
amatus / version.ll
Last active December 26, 2015 09:29
This file has been truncated, but you can view the full file.
target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
target triple = "le32-unknown-nacl"
%struct._IO_FILE = type opaque
%struct.anon = type { i32, i8* }
%struct.gcry_cipher_spec = type { i32, %struct.anon.11, i8*, i8**, %struct.gcry_cipher_oid_spec*, i32, i32, i32, i32 (i8*, i8*, i32)*, i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)*, void (i8*, i8*, i8*, i32)*, void (i8*, i8*, i8*, i32)*, i32 (i32, i32, void (i8*, i32, i8*, i8*)*)*, i32 (i8*, i32, i8*, i32)*, void (i8*, i8*, i32)* }
%struct.anon.11 = type { i8, [3 x i8] }
%struct.gcry_cipher_oid_spec = type { i8*, i32 }
%struct.gcry_md_spec = type { i32, %struct.anon.98, i8*, i8*, i32, %struct.gcry_md_oid_spec*, i32, void (i8*)*, void (i8*, i8*, i32)*, void (i8*)*, i8* (i8*)*, i32, i32 (i32, i32, void (i8*, i32, i8*, i8*)*)* }
%struct.anon.98 = type { i8, [3 x i8] }
@amatus
amatus / avpk.py
Created May 14, 2014 18:32
Python script to extract an AVPK archive
import sys
import io
import struct
def int32(f):
return struct.unpack('<i', f.read(4))[0]
def string(f):
bs = []
while True:
@amatus
amatus / keybase.md
Created August 6, 2014 17:30
keybase.md

Keybase proof

I hereby claim:

  • I am amatus on github.
  • I am amatus (https://keybase.io/amatus) on keybase.
  • I have a public key whose fingerprint is C557 1F92 9030 82B1 6AA9 69BA A080 61C1 6F21 EFE5

To claim this, I am signing this object:

cabal install plugins failed with:
cabal: Error: some packages failed to install:
haskell-src-1.0.2.0 failed during the configure step. The exception was:
ExitFailure 1
plugins-1.5.4.0 depends on haskell-src-1.0.2.0 which failed to install.
SOLUTION:
cabal install haskell-src-1.0.1.5\
cabal install plugins
@amatus
amatus / gist:1642b94ac4e797fd1736
Last active August 29, 2015 14:18
GNUnet URI translator (0.10.1 -> 0.10.2+)
10:39 < major> well, it goes something like this: ssh-keygen -f
servers_CA;ssh-keygen -f users_CA
10:40 < major> after that: ssh-keygen -s <CA_file> -I <description> -n
<principals> <pubkey_file>
10:40 < major> for users
10:40 < major> and: ssh-keygen -s <CA_file> -I <description> -h -n <hostnamess>
<pubkey file>
10:40 < major> for signing host pubkeys
10:41 < major> you can add a @ca-authority in your authorized keys to trust all
signed keys by that CA