Instantly share code, notes, and snippets.

View css-media-queries-cheat-sheet.css
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1025px) and (max-width: 1280px) {}
@media all and (min-width: 768px) and (max-width: 1024px) {}
@media all and (min-width: 480px) and (max-width: 768px) {}
View comodo-ssl.md

Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You'll be asked for the content of the CSR file when ordering the certificate.

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr

This gives you two files:

  • example_com.key -- your Private key. You'll need this later to configure ngxinx.
View test-api-nodejs.md

setup

cat > package.json <<EOF
{
  "name": "test-api",
  "version": "0.1.0",
  "description": "It test the API",
  "main": "index.js",
  "scripts": {
View kong.sh
docker run -d --name kong --link postgres -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=postgres" -e "KONG_CASSANDRA_CONTACT_POINTS=postgres" -e KONG_PG_USER=admin -e KONG_PG_DATABASE=mydb -e KONG_PG_PASSWORD=password -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" -e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest
docker run -p 1337:1337 --link kong --link postgres --name konga -e "NODE_ENV=production" -e "DB_ADAPTER=postgres" -e "DB_HOST=postgres" -e "DB_PORT=5432" -e "DB_USER=admin" -e "DB_PASSWORD=password" -e "DB_DATABASE=mydb" pantsel/konga
View qemu-runner.sh
qemu-img create -f qcow2 hd.qcow2 5G
qemu-system-i386 -boot d -m 512 -hda $PWD/hd.qcow2 -cdrom $PWD/Conectiva6.0.iso -net nic,vlan=0 -net user,vlan=0 -localtime
qemu-kvm -m 16M -drive if=ide,format=qcow2,file=slackware.qcow2 \
-netdev user,id=slirp -device ne2k_isa,netdev=slirp \
-serial stdio -redir tcp:22122::22
View pos-installation-linux-mint.md

add other apt repositories

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
View reverse-proxy.go
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
View postgres-quick-start.md

postgres

server

run server using docker

docker run -d --name postgres -e POSTGRES_DB=third_party_subscription_manager -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -p 5432:5432 postgres:9-alpine
View vanillajs-ajax.js
var client = new XMLHttpRequest();
client.open('POST', 'http://url/v1/optout/123', true);
client.setRequestHeader('Content-type', 'application/json');
var payload = {
"productId": 1319,
"largeAccount": 8080,
"url": "https://dominio:porta/{roleId}",
"countryId": 55,
"transactionUUID": "edaf587b-91e1-11e7-a2de-005056b152d8",
"tags": [],
View pre-sharedkey-aes.py
import sys
import base64
from Crypto.Cipher import AES
class AESCipher(object):
def __init__(self, key):
self.bs = 16
self.cipher = AES.new(key, AES.MODE_ECB)