Skip to content

Instantly share code, notes, and snippets.

View carlochess's full-sized avatar
🎯
Focusing

Carlos Roman carlochess

🎯
Focusing
View GitHub Profile
@julianduque
julianduque / dns.md
Last active May 29, 2018 13:24
DNS Command Line Configuration on macOS

DNS Command Line Configuration on macOS

The following commands work on macOS High Sierra, not tested in previous versions

Get DNS Resolvers

$ scutil --dns | grep 'nameserver\[[0-9]*\]'
@duduribeiro
duduribeiro / Jenkinsfile
Created July 1, 2017 05:10
review_app-Jenkinsfile-final
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'docker build -t openjobs:latest .'
sh 'docker-compose build'
sh 'docker-compose run web bundle install'
sh 'docker-compose run web yarn'
sh 'docker-compose run -e RAILS_ENV=test --rm web bundle exec rake db:drop db:create db:migrate'
anonymous
anonymous / connect_multi.py
Created April 9, 2014 15:57
[PATCH] Set SO_REUSEADDR on outgoing TCP connections - tests
#!/usr/bin/env python
import socket
import random
import itertools
import sys
HOSTS=["www.bbc.co.uk", "guardian.co.uk", "dailymail.co.uk", "reddit.com"]
request = '''
@sambott
sambott / Jenkinsfile
Created March 27, 2017 08:27
Example Jenkinsfile
#!groovy
String GIT_VERSION
node {
def buildEnv
def devAddress
stage ('Checkout') {
@yamalight
yamalight / Makefile
Last active June 18, 2021 17:35
Generate docker TLS certs for secure remote access
# host name of your docker server
HOST=host.net
# ip of your docker server
IP=0.0.0.0
# days of validity for cert
DAYS=365
default:
openssl genrsa -aes256 -out ca-key.pem 4096
openssl req -new -x509 -days ${DAYS} -key ca-key.pem -sha256 -out ca.pem
#include <sys/epoll.h>
#include <fcntl.h>
#include <string.h>
#include "chicken.h"
#define MAX_EVENTS 24
extern void SCM_epoll_wait_cb(C_word vec);
@oconnor663
oconnor663 / bad_git.sh
Created October 4, 2017 17:02
edit a git commit without changing the hash
#! /bin/bash
d="$(mktemp -d)"
# Make a git repo with one file in it.
mkdir "$d/good"
cd "$d/good"
git init
echo good > file.txt
git add -A
@joyrexus
joyrexus / README.md
Last active August 21, 2023 16:59
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

'use strict';
// Dependencies
const gcloud = require('google-cloud', {
projectId: 'sara-bigquery',
keyfileName: 'keyfile.json'
});
const vision = gcloud.vision();
const fs = require('fs');
const async = require('async');
@vongosling
vongosling / gist:9929680
Last active January 31, 2024 04:49
Performance Tuning

Three system configuration parameters must be set to support a large number of open files and TCP connections with large bursts of messages. Changes can be made using the /etc/rc.d/rc.local or /etc/sysctl.conf script to preserve changes after reboot.

1. /proc/sys/fs/file-max: The maximum number of concurrently open files.

fs.file-max = 1000000

2. /proc/sys/net/ipv4/tcp_max_syn_backlog: Maximum number of remembered connection requests, which are still did not receive an acknowledgment from connecting client. The default value is 1024 for systems with more than 128Mb of memory, and 128 for low memory machines.

net.ipv4.tcp_max_syn_backlog = 3240000

3. /proc/sys/net/core/somaxconn: Limit of socket listen() backlog, known in userspace as SOMAXCONN. Defaults to 128.

net.core.somaxconn = 3240000