Skip to content

Instantly share code, notes, and snippets.

@liuliu
liuliu / k-mean on histogram.c
Last active September 26, 2016 06:05
k-mean for layer
gsl_rng_env_setup();
gsl_rng* rng = gsl_rng_alloc(gsl_rng_default);
sqlite3* db = 0;
int h[0x10000];
int kc[0x100];
float kmean[0x100];
uint16_t tbl[0x10000];
int i;
for (i = 0; i < 0x10000; i++)
tbl[i] = i;

CreatePageAction

<?php
use MBITEL\Confluence\EditorActions\CreatePageAction;

$cPager = new CreatePageAction($confluenceClient);
$cPager->createPage($rootPageId);
$cPager->setTextarea($html);
$cPager->setTitle($pageTitle);

The Basics

Anonymous Closures

(function () {
	// ... all vars and functions are in this scope only
	// still maintains access to all globals
}());
@cfj
cfj / console.reverselog.js
Last active August 21, 2017 10:00
More console.log sillyness
var _log = console.log;
window.console.log = function(log){
_log.call(console, log.reverse ? log.reverse() : typeof log === 'string' ? log.split('').reverse().join('') : typeof log === 'number' ? log.toString().split('').reverse().join('') : typeof log === 'boolean' ? !log : log);
};
@n1k0
n1k0 / poor-man-text-editor.md
Last active August 29, 2015 13:55
Paste this to your browser url bar

Poor man text editor

Paste this to your browser url bar:

data:text/html,

@tobiastom
tobiastom / Readme.md
Last active December 23, 2015 21:19
Clone all repositories from a remote SSH server.

Backup repositories

The idea of this script is to backup all repositories from a remote SSH server.

It will search for ´.git´ directories inside the home directory of the "git" user. By default it is the current user, but can be configured by changing the $GIT_USER variable at the top of the script.

All repositories will be cloned into the current working directory.

If there is a previous clone of the repository at the given destination, it will obviously only make a new pull.

@r-sal
r-sal / essentialUnixCommands.md
Last active December 13, 2015 18:09
Most Important UNIX commands
@r-sal
r-sal / CSSSnippets.md
Last active December 11, 2015 05:19
Small collection of various code snippets

Display an HTML attribute value in CSS with attr()
To display the data-prefix attribute of an

heading

<h3 data-prefix="Custom prefix">This is a heading</h3>
h3:before {
  content: attr(data-prefix) " ";
}

@n1k0
n1k0 / casperjs-link-checker.md
Last active August 5, 2016 04:58
A link checker using CasperJS