Skip to content

Instantly share code, notes, and snippets.

View AndreCAndersen's full-sized avatar

André Christoffer Andersen AndreCAndersen

View GitHub Profile
@AndreCAndersen
AndreCAndersen / scp_test
Created July 15, 2017 09:20
How to copy all files from a directory to a remote directory using scp?
andre@andersen:~$ mkdir scptest
andre@andersen:~$ mkdir scptarget
andre@andersen:~$ cd scptest/
andre@andersen:~/scptest$ touch temp1
andre@andersen:~/scptest$ touch temp2
andre@andersen:~/scptest$ scp ~/scptest/* andre@localhost ~/scptarget
cp: cannot stat ‘andre@localhost’: No such file or directory
andre@andersen:~/scptest$ scp ~/scptest/* andre@localhost:~/scptarget
andre@localhost's password: REDACTED
temp1 100% 0 0.0KB/s 00:00
@AndreCAndersen
AndreCAndersen / map_fn_test.py
Last active June 18, 2017 16:30
Testing of map_fn in tensorflow
import tensorflow as tf
f1 = lambda x: x*1
f2 = lambda x: x*2
f3 = lambda x: x*3
x = [f1, f2, f3]
y = [1, 2, 3]
result = list(map(lambda x,y: x(y), x, y))
import inspect
import types
def execute_source(callback_imports, callback_name, callback_source, args):
for callback_import in callback_imports:
exec(callback_import, globals())
exec('import time' + "\n" + callback_source)
callback = locals()[callback_name]
return callback(*args)
do {
save copy of network
find and delete lowest weighted connection of network
do one epoch of learning and calculate new network error
if (new network error is above lower threshold){
relearn lost knowledge
}
} while (network relearning converged in time)
return saved copy of network
# This source code is provided under the following Creative Commons license:
# Attribution-NonCommercial-ShareAlike 4.0 International
# https://creativecommons.org/licenses/by-nc-sa/4.0/
# Please contact the author for commercial use: andre@andersen.im
# Fixed parameters
exchange <- 'OSE'
instrument <- 'OSEBX'
p_level = 0.90
@AndreCAndersen
AndreCAndersen / bits_in_bytes.cs
Created March 27, 2017 10:31
Hiding Your Bits in the Bytes: A basic example of modern steganography using C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
namespace SteganographyTest
@AndreCAndersen
AndreCAndersen / feature_reduction_using_svd.r
Created March 27, 2017 09:52
Practical Feature Reduction Using SVD in R
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
X_all_size = 50
n = 6 # Original number of features
k = 2 # Reduced number of features
split_ratio = 0.8
#G enerate some dummy data
X_all <- hilbert(X_all_size)[,1:n]