Skip to content

Instantly share code, notes, and snippets.

View pavelnikolov's full-sized avatar
🌴
On vacation

Pavel Nikolov pavelnikolov

🌴
On vacation
View GitHub Profile
@pavelnikolov
pavelnikolov / groupcache.go
Created August 21, 2018 15:19 — forked from fiorix/groupcache.go
Simple groupcache example
// Simple groupcache example: https://github.com/golang/groupcache
// Running 3 instances:
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081
// Testing:
// curl localhost:8080/color?name=red
package main
import (
@pavelnikolov
pavelnikolov / tutorial.md
Created July 25, 2018 13:39 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

dash_id=xxxx
api_key=xxx
app_key=xxx
# 1. export
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level
@pavelnikolov
pavelnikolov / webtest.sh
Created July 18, 2016 00:38 — forked from technovangelist/webtest.sh
ZSH script to visit a page over and over again with random seconds between visits
#!/bin/zsh
# use webtest.sh <url to visit>
zmodload -i zsh/mathfunc
for i in {1..1000}
do
sleep $(( rand48()*2 ))
curl $1
done
@pavelnikolov
pavelnikolov / fix-wordpress-permissions.sh
Created March 30, 2016 03:38 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@pavelnikolov
pavelnikolov / index.html
Created February 8, 2016 13:27 — forked from anonymous/index.html
JS Bin React + Redux todo app // source http://jsbin.com/qejizi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="React + Redux todo app">
<script src="http://fb.me/react-with-addons-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/redux/3.2.1/redux.js"></script>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
<meta charset="utf-8">
@pavelnikolov
pavelnikolov / index.html
Created February 7, 2016 12:45 — forked from anonymous/index.html
JS Bin React + Redux todo app // source http://jsbin.com/qejizi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="React + Redux todo app">
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/redux/3.2.1/redux.js"></script>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
<meta charset="utf-8">
var crypto = require("crypto")
, util = require("util")
, express = require("express");
var s3 = {
access_key_id: "<access_key>"
, secret_key: "<your_secret_key>"
, bucket: "<your_bucket>"
, acl: "public-read"
, https: "false"
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");