Skip to content

Instantly share code, notes, and snippets.

@Moddus
Moddus / BlasWrapper.java
Created February 12, 2016 12:18
deeplearning4j load openblas
public class BlasWrapper extends BaseBlasWrapper {
private static final Logger log = LoggerFactory.getLogger(BlasWrapper.class);
public final static String FORCE_NATIVE = "org.nd4j.linalg.cpu.force_native";
static {
// System property toggle hasSetNative var
// if the property isn't set the warning is allways displayed.
String forceNative = System.getProperty(FORCE_NATIVE,"false");
boolean hasSetNative = false;
public static File getFile(String name) {
URL url = Thread.currentThread().getContextClassLoader().getResource(name.replace(File.separatorChar, '/'));
if(url != null) {
try {
return new File(url.toURI());
} catch (Exception var3) {
throw new RuntimeException("Resource was found on classpath, but cannot be resolved to a normal file (maybe it is part of a JAR file): " + name);
}
} else {
File file = new File(name);
import numpy as np
class Perzeptron:
def __init__(self, t, my, d, maxiter, sign):
self.t = t
self.my = my
self.maxiter = maxiter
self.sign = sign
self.w = np.mat([[-self.t],[1],[1]])
using adaptive_systeme
data = [[1 0 0],[1 0 1], [1 1 0], [1 1 1]]
result_OR = [0; 1; 1; 1]
result_AND = [0; 0; 0; 1]
result_XOR = [0; 1; 1; 0]
p = Perzeptron(.5, .1, result_OR, 1000, lineare)
training(p, data)
@Moddus
Moddus / go_routines_with_chan.go
Last active August 29, 2015 14:20
Just some golang snipptes
package main
import (
"log"
)
func main() {
c := make(chan string)
for i := 0; i < 10; i++ {
go func(i int, c chan string) {
@Moddus
Moddus / _service.md
Last active August 29, 2015 14:12 — forked from naholyr/_service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#!/bin/bash
COMPILE=""
ssh bsd9 "mkdir -p $1 && rm -rf $1/*"
for filename in *; do
if [[ -f $filename ]]; then
EXT=${filename##*.}
if [ "$EXT" == c ] || [ "$EXT" == h ]; then
/*
* Search a particular hash table for a conversation with the specified
* {addr1, port1, addr2, port2} and set up before frame_num.
*/
static conversation_t *
conversation_lookup_hashtable(GHashTable *hashtable, const guint32 frame_num, const address *addr1, const address *addr2,
const port_type ptype, const guint32 port1, const guint32 port2)
{
conversation_t* convo=NULL;
conversation_t* match=NULL;
# commands
alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'
alias sl=ls # often screw this up
alias ..='cd ..'
alias ...='cd ../..'
alias less='less -N'
fd = socket(AF_INET, SOCK_DGRAM, 0);
server_addr.sin_family = AF_INET;
#ifdef HAVE_SIN_LEN
server_addr.sin_len = sizeof(struct sockaddr_in);
#endif
server_addr.sin_addr.s_addr = "127.0.0.1";
server_addr.sin_port = htonl(7);
memset((void *) buf, ’A’, sizeof(buf));