Skip to content

Instantly share code, notes, and snippets.

@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
package main
import (
"log"
"net/http"
"os"
)
var port = "8080"
var root = "."
#!/usr/bin/ruby
# encoding: utf-8
# Shamelessly stolen and adapted from https://github.com/raycchan/bazaar
require 'erb'
# Generate random names
class Rasgele # rubocop:disable ClassLength
RANDOM_FORMAT = '<%= superadjective %>-<%= supername %>-<%= random %>'
#!/usr/bin/ruby
# encoding: utf-8
require 'optparse'
require 'ostruct'
# Generate random names
class Zar # rubocop:disable ClassLength
DEFAULT_LANGUAGE = :auto
DEFAULT_SEPARATOR = '-'
@progrium
progrium / bash.sh
Created February 17, 2015 14:19
Comparing natural brevity and concise expressiveness between Go and shell/Bash for certain tasks using each tool's "standard" library.
curl -s "$url" | tar -zxC "$dest"
@roktas
roktas / main.go
Last active August 29, 2015 14:27 — forked from TheHippo/main.go
Benchmarking Go Mutex overhead
package main
import (
"fmt"
"sync"
)
type unlocked struct {
i int
}
@roktas
roktas / README.md
Last active September 15, 2015 10:10
NYP 2015 final sorusu

Kullanıcıya görüntülenen iletilerin İngilizce olduğu olağan bir Ruby yazılımı düşünün. Örneğin böyle bir yazılımda kullanıcıya görüntülenen bir hoşgeldin iletisi aşağıdakine benzer bir şekilde gerçeklenir:

puts "Welcome!"
=> Welcome!

Türk kullanıcılar gözönüne alınarak yazılımın aynı iletileri Türkçe olarak görüntülemesi için tr adında bir çeviri modülü geliştirileceğini varsayalım. Bu modül kullanıldığında yazılımdaki İngilizce ileti görüntüleyen tüm satırlarda

/*
* Dizgideki karakterler hakkında bilgi görüntüle.
*
* HATALI sürüm: geniş karakter desteği olmayan işlevlerle çalışılıyor.
*/
#include <stdio.h>
#include <string.h>
int
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
/*
* Hem Linux, hem de Windows konsolda Türkçe karakterleri hatasız görüntüleyen
* bir kod.
*
* Alakasız ipucu: Windows 7'de Visual Studio Express 2010 sürümünde program
* çalıştıktan sonra konsolun kaybolmaması için:
@roktas
roktas / .gitignore
Created December 10, 2011 13:26 — forked from potch/gist_line_numbers.css
CSS to add line numbers to embedded gists
We couldn’t find that file to show.