Skip to content

Instantly share code, notes, and snippets.

View santigimeno's full-sized avatar

Santiago Gimeno santigimeno

View GitHub Profile
@barrysteyn
barrysteyn / Base64Decode.c
Last active May 13, 2024 07:45
Base64 Encoding/Decoding with the OpenSSL c api
//Decodes Base64
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <string.h>
#include <stdio.h>
int calcDecodeLength(const char* b64input) { //Calculates the length of a decoded base64 string
int len = strlen(b64input);
int padding = 0;
// you can omit DI for _light_ dependencies
var async = require('async');
module.exports.inject = function( dependencies ){
// no direct require of _heavy_ dependencies
var mysql = dependencies.mysql;
var redis = dependencies.redis;
// do whatever
@wheeyls
wheeyls / example.js
Last active December 14, 2015 20:40
Export a library for commonjs, nodejs, and browser.
function myLib() {
return {
code: function () {}
, goes: function () {}
, here: function () {}
}
}
exporter('myLib', myLib);
var cluster = require('cluster');
var PORT = +process.env.PORT || 1337;
if (cluster.isMaster) {
// In real life, you'd probably use more than just 2 workers,
// and perhaps not put the master and worker in the same file.
cluster.fork();
cluster.fork();
cluster.on('disconnect', function(worker) {
@bodokaiser
bodokaiser / Makefile
Last active April 2, 2025 12:39
Example of how to use libuv`s QUEUE.
build:
$(CC) -o queue.o queue.c
@julianscheel
julianscheel / build.sh
Created October 23, 2013 13:54
cross compile helper scripts for vlc
#!/bin/sh
export SYSROOT=/home/julian/dev/rpi/rpi-buildroot/output/rootfs-debug/staging
export PATH=/home/julian/dev/rpi/ct-ng/host/bin/:$PATH
echo "Build"
make -j9 V=1 || exit 0
echo "Install"
make DESTDIR=$(pwd)/install/ install
@gitaarik
gitaarik / git_submodules.md
Last active November 6, 2025 22:10
Git Submodules basic explanation

Git Submodules - Basic Explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@totherik
totherik / npmjs.ini
Last active August 29, 2015 13:56
npmjs.org registry install script
; CouchDB Config
; Drop in PREFIX/local.d/npmjs.ini
[couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true
[httpd]
secure_rewrites = false
@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active September 30, 2025 01:16
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@afolarin
afolarin / resource_alloc_docker.md
Last active March 18, 2024 17:01
Resource Allocation in Docker

#Container Resource Allocation Options in docker-run

now see: https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources

You have various options for controlling resources (cpu, memory, disk) in docker. These are principally via the docker-run command options.

##Dynamic CPU Allocation -c, --cpu-shares=0
CPU shares (relative weight, specify some numeric value which is used to allocate relative cpu share)