Skip to content

Instantly share code, notes, and snippets.

@tiborsimon
tiborsimon / all.m
Last active November 12, 2015 20:41
Equation engine
%% Signal synthesizer functions
function s = construct_with_n_N()
n = get_n();
N = get_N();
phi = data.phi;
k = 0:n-1;
k = k/n;
phi = phi*pi/180;
s = trigfun(2*pi*N*k + phi);
@tiborsimon
tiborsimon / mandatory_arbitrary.py
Created October 29, 2015 18:31
Regular expression generator for mandatory characters in arbitrary order.
from itertools import permutations
import re
def generate_mandatory_arbitrary(content):
pattern_string = '('
for p in permutations(content):
pattern_string += '(.*'
for i in p:
pattern_string += '{}.*'.format(i)
pattern_string += ')|'
@tiborsimon
tiborsimon / fuzzy_demo.py
Last active October 26, 2015 07:53
Fuzzy searching and sorting algorithm
import fuzzy
from pprint import pprint
data_list = [
'efo',
'efoo',
'dfsfoo',
'efiofo',
'abc',
'cba',
@tiborsimon
tiborsimon / printout.txt
Last active October 24, 2015 16:11
Noun downloader printout
Word count: 200 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=adenokarcin%C3%B3ma#mw-pages
Word count: 400 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=agr%C3%A1rt%C3%B6rv%C3%A9ny#mw-pages
Word count: 600 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=akaszt%C3%B3fahumor#mw-pages
Word count: 800 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=alapilletm%C3%A9ny#mw-pages
Word count: 1000 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=almaexport#mw-pages
Word count: 1200 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=android#mw-pages
Word count: 1400 next_link: https://hu.wiktionary.org/w/index.php?title=Kateg%C3%B3ria:magyar_f%C5%91nevek&pagefrom=anyak%C3%B6nyv#mw-pages
Word count: 1600 next_link: http
@tiborsimon
tiborsimon / noun_list_creation.py
Last active October 24, 2015 16:10
Generate noun list from wiki site
import requests
from bs4 import BeautifulSoup
import json
words = []
def main():
next_link = 'https://hu.wiktionary.org/wiki/Kategória:magyar_főnevek'
try:
while(1):
@tiborsimon
tiborsimon / basic_use_case.m
Last active October 13, 2015 22:26
Simple Input Parser code samples
function ret = my_function(varargin)
params.a = 42;
params.b = 'answer';
params.c = 55.3;
params = simple_input_parser(params, varargin);
% further functionalities that uses the params struct
@tiborsimon
tiborsimon / file_tree.txt
Created October 6, 2015 21:48
MATLAB Library System documentation
my_mls_package
│ install.m
│ uninstall.m
│ librarydata.txt
└───library
│ files1.m
│ files2.m
│ ...
@tiborsimon
tiborsimon / type_command.m
Last active September 24, 2018 05:59
Matlab string to keypresses function
% Based on the thread: http://stackoverflow.com/questions/32710709/prepare-command-in-matlab/32721523?noredirect=1#comment53292353_32721523
function type_command(command)
commandwindow; %// make Matlab command window have focus
robot = java.awt.Robot; %/ Java Robot class
for k=1:length(command)
switch command(k)
case 'a'
robot.keyPress (java.awt.event.KeyEvent.VK_A);
robot.keyRelease (java.awt.event.KeyEvent.VK_A);
case 'b'
@tiborsimon
tiborsimon / signals.py
Created September 11, 2015 11:28
Blinker monitoring wrapper
from blinker import signal
import pprint
import datetime
class MultipleResponseError(Exception):
pass
class Signal(object):
@tiborsimon
tiborsimon / file_structure.txt
Last active August 29, 2015 14:23
MATLAB Library System file structure
my_library | top level folder of your library
│ install.m | add your library to the MATLAB path
│ librarydata.txt | edit your library name and version here
│ LICENSE | add your license here optionally
│ README.md | you can edit this readme file optionally
│ uninstall.m | remove your library from the MATLAB path
│ |
└───library | all your code goes here
dummy_lib_test.m | dummy deletable function for installation testing