Skip to content

Instantly share code, notes, and snippets.

View AlexxNica's full-sized avatar
🚀

Alexandre Nicastro AlexxNica

🚀
View GitHub Profile
@ccnokes
ccnokes / axios-instance-config.js
Created July 6, 2017 16:23
Good default configuration for axios in node.js
const axios = require('axios');
const http = require('http');
const https = require('https');
module.exports = axios.create({
//60 sec timeout
timeout: 60000,
//keepAlive pools and reuses TCP connections, so it's faster
httpAgent: new http.Agent({ keepAlive: true }),
@genadipost
genadipost / foreman_proxy_install.md
Last active April 4, 2018 11:04
foreman proxy install
yum -y install https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm; \
yum -y install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; \
yum -y install https://yum.theforeman.org/releases/1.15/el7/x86_64/foreman-release.rpm; \
yum -y install foreman-release-scl; \
yum -y install foreman-installer; \
echo "192.168.227.154 foreman1.test.local foreman1" >> /etc/hosts; \
echo "192.168.227.154 web-foreman.test.local" >> /etc/hosts; \
echo "192.168.227.156 proxy1.test.local proxy1" >> /etc/hosts; \
<html>
<body>
<script>
function sum(array) {
var num = 0;
for (var i = 0, l = array.length; i < l; i++) num += array[i];
return num;
}
@ELLIOTTCABLE
ELLIOTTCABLE / es2016-jxa.js
Created May 2, 2017 09:20
ECMAScript 2017 `async` in macOS Sierra JavaScriptCore
#!/usr/bin/env osascript -l JavaScript
// macOS Sierra uses a JavaScriptCore analagous to that in Safari 10.1. This supports all of
// ECMAScript 2015 (“ES6”), and even much of ECMAScript 2016! For instance, try `async` functions:
async function hello(){
return "Hello, world!"
}
function run(argv) {
var p = hello();
@ldez
ldez / gmail-github-filters.md
Last active July 18, 2025 16:51
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge mkThenElse;
cfg = config.r6d.config-generator;
computers = config.r6d.computers;
profiles = config.r6d.profiles;
in
{
@karpathy
karpathy / nes.py
Last active June 7, 2025 14:26
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize
@kekru
kekru / Remote API via daemon.json.md
Last active May 19, 2025 06:11
Enable Docker Remote API via daemon.json
const presets = ['react', 'es2015'];
export const development = {
presets,
};
export const production = {
presets,
plugins: ['transform-remove-console'],
};