Skip to content

Instantly share code, notes, and snippets.

View oprypin's full-sized avatar

Oleh Prypin oprypin

View GitHub Profile
#!/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 ..
@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 ~
@jimeh
jimeh / show-and-hide-any-app.applescript
Created June 8, 2011 00:45
AppleScript to help make any app toggle-able via a global hotkeys like the Twitter and Sparrow apps.
-----------------------------------------
-- Show and Hide <application>
-----------------------------------------
--
-- This script allows you to easily
-- toggle the visibility of a specific
-- app, similar to how Twitter and
-- Sparrow toggle with their global
-- hotkey option.
--
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}]
@ivanistheone
ivanistheone / samizdat-shell-help.bash
Last active December 17, 2020 22:23 — forked from kovetskiy/samizdat-shell-help.bash
help text for bas script based on ### comment + awk command
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@tmatilai
tmatilai / Vagrantfile
Last active January 1, 2021 19:49
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
# URI of the local (caching) HTTP proxy
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123'
# Configures vagrant-cachier and vagrant-proxyconf.
# Should be called only on "local machine" providers.
def configure_caching(config)
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.enable_nfs = true
config.cache.enable :gem
config.cache.enable :npm
@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
@jwo
jwo / query.graphql
Last active May 31, 2021 20:53
GraphQL example: current user's 100 most current public repos
{
viewer {
repositories(privacy: PUBLIC, first: 3, orderBy: {field: PUSHED_AT, direction: DESC}) {
nodes {
nameWithOwner
url
}
}
}
}