Skip to content

Instantly share code, notes, and snippets.

View zaiste's full-sized avatar
🌀
Loading...

Jakub Neander zaiste

🌀
Loading...
View GitHub Profile
echo '-> installing `xcode-select`'
xcode-select --install
echo '-> installing `homebrew`'
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo '-> enable `homebrew/bundle`'
brew tap homebrew/bundle
echo '-> install packages from `Brewfile`'
@zaiste
zaiste / osx-configuration.sh
Created December 30, 2017 15:30
MacOS configuration
CURRENT="`pwd`"
echo 'Keep-alive: update existing `sudo` time stamp until `.osx` has finished'
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
echo 'Menu bar: disable transparency'
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool true
echo 'Menu bar: show remaining battery time (on pre-10.8); hide percentage'
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
@zaiste
zaiste / README.md
Last active December 30, 2017 15:26
CSV Parsing in Python, Ruby and Golang
@zaiste
zaiste / postgresql-copy-csv-import-export.md
Last active September 2, 2024 09:50
Using PostgreSQL's COPY to import & export CSV files

Using PostgreSQL's COPY to import & export CSV files

COPY can read/write data not only from/to CSV, but also from/to binary files. For the import, the table must exist along with its columns matching CSV columns.

Export table to CSV

COPY <table> TO 'file.csv' DELIMITER ',' CSV HEADER; 
Verifying that "zaiste.id" is my Blockstack ID. https://onename.com/zaiste
@zaiste
zaiste / README.md
Last active June 5, 2017 21:45
Marko client-side routing & Node.js backend using Huncwot

Marko client-side routing & Node.js backend using Huncwot

This is the initial page index.marko

<init-app/>
<!doctype html>
<html>
<head>
 Marko + Huncwot Example
@zaiste
zaiste / ruby-datamapper.rb
Created February 5, 2017 22:52
Ruby & Datamapper
require 'data_mapper'
require 'dm-pg-types'
DataMapper.setup(:default, 'postgres://localhost/play')
class Person
include DataMapper::Resource
property :id, Serial
property :name, String
@zaiste
zaiste / tictactoe-om.cljs
Created February 5, 2017 22:43
Tic Tac Toe in Om/ClojureScript
(ns om-tictactoe.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def app-state (atom {:tiles ["o" "" ""
"" "x" ""
"" "" ""]
:turn "o"}))
@zaiste
zaiste / xml-clojure.clj
Created February 5, 2017 22:36
Create XML in Clojure
(ns clojure-xml-example.core
(:require [clojure.data.xml :as xml])
(:gen-class))
(def bookshelf
(xml/element :books {}
(xml/element :book {:author "Stuart Halloway"}
"Programming Clojure")
(xml/element :book {:author "Christian Queinnec"}
"Lisp in Small Pieces")
@zaiste
zaiste / playground.erl
Created February 5, 2017 22:33
Erlang playground
-module(play).
-export([fall_velocity/2, fall_velocity2/2, fall_velocity3/2, countdown/1, countup/1, factorial/1, product/1, falls/1, tripler/2, square/1, report/1]).
fall_velocity({Planemo, Distance}) ->
fall_velocity(Planemo, Distance).
fall_velocity(earth, Distance) when Distance >= 0 ->
math:sqrt(2 * 9.8 * Distance);
fall_velocity(moon, Distance) when Distance >= 0 ->
math:sqrt(2 * 1.6 * Distance);