Skip to content

Instantly share code, notes, and snippets.

@hdf
hdf / index.js
Last active February 13, 2016 12:10
node-ffi example
var ffi = require('ffi'),
ref = require('ref');
//ArrayType = require('ref-array');
//var StringArray = ArrayType('string');
var dll = ffi.Library('judit1.dll', {
//'main': [ 'int', [ 'int', StringArray ] ],
'calculator': [ 'float' , [ ref.refType(ref.types.char), 'bool',
'long', 'long', 'long', 'long', 'double',
@hdf
hdf / sort.bat
Created February 7, 2016 18:21
Sort csv
@echo off
setlocal ENABLEDELAYEDEXPANSION
set dir=%cd:\=/%
set dir=%dir::=%
sh -login -c "cd /%dir% && sort -t $'\t' -k 17 -g tajkep_.txt -o tajkep_sorted.txt"
@hdf
hdf / t1.cpp
Created February 8, 2016 19:27
node-ffi experiment
// g++ -O3 -pie -shared t1.cpp -o t1.dll
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
extern "C" {
__declspec(dllexport)
void callme(char ***out, char *out2) {
char s[2][3][6] = {{"one", "two", "three"}, {"four", "five", "six"}};
@hdf
hdf / crontabs.sh
Created February 28, 2016 16:01
list all cron jobs (from: http://stackoverflow.com/a/137173)
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
# Given a stream of crontab lines, exclude non-cron job lines, replace
@hdf
hdf / .bashrc
Last active March 1, 2016 16:43
bash aliases for myself
alias b='unset HISTFILE'
alias c='sudo apt-get autoremove && sudo apt-get autoclean'
alias i='sudo apt-get install'
alias u='sudo apt-get purge'
alias ..='cd ..'
@hdf
hdf / random_map.html
Created April 11, 2016 10:21
js random to canvas image
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Random Map</title>
</head>
<body>
<canvas id="map" style="border: solid 1px black;"></canvas>
<script>
var canvas = document.getElementById('map');
// Extension project for: https://github.com/joshaven/string_score/
// See: https://github.com/joshaven/string_score/issues/28
/**
* Gives back an array of indexes of the unique closest matches,
* on a string array to a string.
* 'Hello World'.closest(['el', 'll', 'o', 'll']); //=> [ 0, 1 ]
*/
String.prototype.closest = function(words, fuzziness, one2many) {
'use strict';
@hdf
hdf / expNand.txt
Last active December 6, 2019 15:30
Thought experiment. NAND logic gate (and others) with only exponentiation.
//NAND logic gate (and others) with only exponentiation.
/*
Exponentiation: 13
0^0 1
0^1 0
1^0 1
1^1 1
NAND: 7
@hdf
hdf / Form1.Designer.cs
Last active February 5, 2017 14:37
RenderDLL
namespace ProgressViewer {
partial class Form1 {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
// Ennek a fájlnak a letöltési linkje:
// https://gist.github.com/hdf/2a4f01f24c1f74bd48252ee297ed53b2
// Felfedezendő terület vizuális paraméter generáló: https://gist.github.com/hdf/63f5f088d11039972778
// Linux alatti építés és futtatás (ha nincs fönt g++: "sudo apt-get install g++"):
// g++ -O3 -fopenmp RKF7_4D_heterokl_Dll.cpp -o judit1
// chmod +x ./judit1
// ./judit1 -MMM 10 -t 1300 -o eredmeny.txt
// less ./eredmeny.txt
// (less -ből való kilépéshez nyomd meg a q billentyűt.)