Skip to content

Instantly share code, notes, and snippets.

View ernestas-poskus's full-sized avatar
💭
Lengthy disk encryption password eliminates keystroke errors

Ernestas Poskus ernestas-poskus

💭
Lengthy disk encryption password eliminates keystroke errors
View GitHub Profile
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
package httpclient
import (
"net"
"net/http"
"time"
)
type Config struct {
ConnectTimeout time.Duration

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@ernestas-poskus
ernestas-poskus / reflection.go
Last active August 29, 2015 14:27 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@ernestas-poskus
ernestas-poskus / gist:0107e637a72082fdb57e
Created November 9, 2015 21:00 — forked from analytically/gist:5760207
Ansible /etc/network/interfaces template
# {{ ansible_managed }}
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
{% if ansible_interfaces|length > 2 %}
@ernestas-poskus
ernestas-poskus / interfaces
Created November 10, 2015 19:04 — forked from analytically/interfaces
Ansible interface bonding tasks.
# {{ ansible_managed }}
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
{% if ansible_interfaces|length > 2 %}
@ernestas-poskus
ernestas-poskus / gocraftweb.go
Created November 15, 2015 17:25 — forked from elithrar/gocraftweb.go
HTTP Request Contexts in Go — Examples — http://elithrar.github.io/article/map-string-interface/
package main
import (
"fmt"
"log"
"net/http"
"github.com/gocraft/web"
)