Skip to content

Instantly share code, notes, and snippets.

View oprypin's full-sized avatar

Oleh Prypin oprypin

View GitHub Profile
@mohayonao
mohayonao / morse-code.json
Created July 14, 2014 06:18
morse-code.json
{
"0": "-----",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
@vinyll
vinyll / python3.4 installer
Created October 19, 2014 09:45
Installing python3.4 at Alwaysdata
BASH_FILE=~/.zshrc
mkdir -p ~/.python/src
cd !$
wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz --no-check-certificate
tar xfz Python-3.4.2.tgz
cd Python-3.4.2
mkdir $HOME/.python/python3.4
./configure --prefix=!$ && make && make install
cd ~
@jc00ke
jc00ke / llvm-update-alternatives
Created November 4, 2014 02:19
LLVM & clang alternatives
#!/usr/bin/env sh
sudo update-alternatives --install \
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.4 200 \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.4 \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 \
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.4 \
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.4 \
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.4 \
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.4 \
#!/usr/bin/env sh
# A wrapper around the Nim compiler to allow for easy scripting of Nim. Puts
# all temporary files in a temporary directory and cleans up after itself.
#
# Usage:
# - add `#!/usr/bin/env nimrun` at the beginning of your script
# - execute the nim file with it, for example, `nimrun file.nim args`
#
# Possible future extentions:
@flaviut
flaviut / libyaml.nim
Last active August 29, 2015 14:14
Nim libyaml wrapper. Here be dragons.
type
yaml_version_directive_t* = object
major*: cint
minor*: cint
type
yaml_tag_directive_t* = object
handle*: cstring
prefix*: cstring
type
yaml_encoding_t* {.size: sizeof(cint).} = enum
@megawac
megawac / .travis.yml
Created May 5, 2015 19:48
NIM travis.yml file
language: C
compiler:
- gcc
before_install:
# Install nim
- git clone -b master git://github.com/Araq/Nim.git --depth 1
- cd Nim
- git clone -b master --depth 1 git://github.com/nim-lang/csources
- cd csources && sh build.sh
- cd ..
@keplersj
keplersj / logged.rs
Created July 25, 2015 21:00
Gist demonstrating the ability to run Crystal code from Rust.
#[link(name = "logger")]
extern {
fn CrystalLog(text: *const u8);
}
fn log(text: &'static str) {
unsafe{ CrystalLog(text.as_bytes().as_ptr()) };
}
fn main() {
data = [{"Brian", 42}, {"Alan", 30}, {"Brian", 32}]
# unstable
data.sort_by &.[0] # => [{"Brian", 42}, {"Alan", 30}, {"Brian", 32}]
# stable
data.map_with_index { |d,i| {d,i} }.sort_by { |di| {di[0][0], di[1]} }.map { |di| di[0] } # => [{"Alan", 30}, {"Brian", 42}, {"Brian", 32}]
@jhass
jhass / server.cr
Created July 22, 2016 12:05
Simple debug HTTP server in Crystal
require "option_parser"
require "http/server"
require "json"
class Settings
property port = 3000
property host = "127.0.0.1"
property? show_headers = false
property? show_raw_json = false
end
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active May 5, 2024 04:26
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.