Blog Spot!


Converter to print in binary format

#include <stdio.h>      /* printf */
#include <string.h>     /* strcat */
#include <stdlib.h>     /* strtol */

const char *byte_to_binary(int x) {
    static char b[9];
    b[0] = '\0';

    int z;
    for (z = 128; z > 0; z >>= 1) {
        strcat(b, ((x & z) == z) ? "1" : "0");
    }

    return b;
}

int main(void) {
    printf("%s\n", byte_to_binary(5));
    return 0;
}

stackoverflow

Added on 20.Oct.2015
Tags: c binary convert

7z all files in directory

7z a name.7z files/directorys

7zip can make also zip files, just add the desired extension to the end of the file you want to make the archive.

Added on 19.Oct.2015
Tags: linux zip command cmd terminal archive

Zip all files in directory

zip -r myfiles.zip myfiles
stackexchange

Added on 19.Oct.2015
Tags: linux zip command cmd terminal archive

Delete all, but the last N rows in a table

DELETE FROM `table_name`
WHERE id NOT IN (
  SELECT id
  FROM (
    SELECT id
    FROM `table_name`
    ORDER BY id DESC
    LIMIT 100 -- keep this many records
  ) foo
);

stackoverflow

Added on 19.Oct.2015
Tags: sql query clean delete

Linux command to find number of rows, lines of code in project

Find number or rows in project:
find . "(" -name "*.json" -or -name "*.js" ")" -print0 | xargs -0 wc -l

Added on 15.Oct.2015
Tags: project cmd linux number count

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top