Skip to content

Instantly share code, notes, and snippets.

View sydcanem's full-sized avatar
🏠
Working from home

James Santos sydcanem

🏠
Working from home
View GitHub Profile
@sydcanem
sydcanem / Nginx gzip.conf
Last active March 3, 2024 18:27
Gzip configuration for Nginx
#Enable Gzip compressed.
gzip on;
# Enable compression both for HTTP/1.0 and HTTP/1.1.
gzip_http_version 1.1;
# Compression level (1-9).
# 5 is a perfect compromise between size and cpu usage, offering about
# 75% reduction for most ascii files (almost identical to level 9).
gzip_comp_level 5;
@sydcanem
sydcanem / List.js
Last active September 15, 2020 11:04
import React from "react";
import Checkbox from "./Checkbox";
import { status } from "./constants";
export default function List(props) {
const { items } = props;
return (
<ul>
{items.map((item) => {
[
{
"id": 1,
"name": "Table",
"items": [
{ "id": 3, "name": "Bar Table" },
{ "id": 4, "name": "Dining" },
{ "id": 5, "name": "Coffee Table" }
]
},
@sydcanem
sydcanem / README.md
Last active September 6, 2020 07:31
Express ES6 Boilerplate

Express Boilerplate in ES6

Because it's hard to memorize boilerplates...

@sydcanem
sydcanem / timer.js
Created September 6, 2020 07:11
Promise Timer
function timeout(ms, action) {
const timer = new Promise((resolve, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject(`Timed out in ${ms}ms.`);
}, ms);
});
return Promise.race([timer, action]);
}
@sydcanem
sydcanem / launch.json
Created February 23, 2018 18:58
VSCode Launch config for React SSR
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Chrome",
@sydcanem
sydcanem / main.go
Created January 7, 2018 22:03 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"

Keybase proof

I hereby claim:

  • I am sydcanem on github.
  • I am sydcanem (https://keybase.io/sydcanem) on keybase.
  • I have a public key ASDreDHKszuBzoPCDK7GhN8pcHPOiOColl5NSpwJ0Z2qBAo

To claim this, I am signing this object:

#!/bin/sh
#
# Use ipfw to throttle bandwidth.
# usage:
# ./throttle.sh # Throttle at default (60KB/s)
# ./throttle.sh 5 # Throttle at custom speed (5KB/s)
# ./throttle.sh off # Turn throttling off
# flush rules
ipfw del pipe 1
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here