Skip to content

Instantly share code, notes, and snippets.

package main
import (
"log"
"net/http"
"os"
)
var port = "8080"
var root = "."
@roktas
roktas / freq.sh
Last active August 29, 2015 13:58
Read a file of text, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies.
#!/bin/sh
# http://franklinchen.com/blog/2011/12/08/revisiting-knuth-and-mcilroys-word-count-programs/
# http://www.slideshare.net/jaguardesignstudio/why-zsh-is-cooler-than-your-shell-16194692
tr -cs A-Za-z '\n' |
tr A-Z a-z |
sort |
uniq -c |
sort -rn |
sed ${1}q
@getify
getify / gist:9895188
Last active August 17, 2016 23:51
composition vs. delegation
// composition
var obj1 = {
doSomething: function(myId) {
console.log( "Something: " + myId() );
}
};
var obj2 = {
id: "obj2",
class GroupersController < ApplicationController::Base
def create
@grouper = Grouper.new(leader: current_member)
if @grouper.save
ConfirmedGrouperEmails.new(@grouper).deliver
AssignBarForGrouper.enqueue(@grouper.id)
redirect_to home_path
else
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active February 13, 2025 13:38 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
@roktas
roktas / angular-xeditable-example.markdown
Created November 5, 2013 23:51
A Pen by Recai Oktaş.

Cached version of http://unix-heaven.org/proxmox-ve-kvm-template

How to create a KVM template in Proxmox VE

Wed, 10/31/2012 - 19:01 — dnaeon

Probably this is something that most people working with Proxmox VE have stumbled upon.

In Proxmox VE you can only use (at least for now) OpenVZ templates. If you are intrested in running Proxmox VE with KVM (as I was), then you will be surprised that the only supported templates are for OpenVZ.

@jedy
jedy / verify.go
Created July 10, 2013 05:10
use publib key to verify in golang
package main
import (
"crypto"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/base64"
"fmt"
)
function showFolderInSite() {
var done = false;
// The while loop and try - catch statement are used to automatically retry if
// there's an issue during the execution (common issue: SitesApp: Internal error).
while (!done) {
try {
var files = DocsList.getFolderById('0B_F4bEJWqt_VRnUzRElES2JoMXM').getFiles();
var page = SitesApp.getPageByUrl('https://sites.google.com/a/bil.omu.edu.tr/belge/a');
var listItems = page.getListItems();
@fernandoaleman
fernandoaleman / gist:5083680
Last active October 17, 2023 12:02
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.