Skip to content

Instantly share code, notes, and snippets.

@i-blis
i-blis / genpass.clj
Created August 10, 2021 01:16
Simple Password Generator
#!/usr/bin/env bb
(require '[clojure.tools.cli :refer [parse-opts]])
(def generator (java.security.SecureRandom.))
(defn gen-pass [alphabet length]
(let [bound (count alphabet)
idxs (repeatedly length #(.nextInt generator bound))]
(apply str (map alphabet idxs))))
@i-blis
i-blis / recipe.txt
Created March 2, 2015 15:18
Change hostname
Edit `/etc/hostname` and then run `/etc/init.d/hostname.sh start`
@i-blis
i-blis / recipe.md
Created March 2, 2015 15:15
Change time zone on server

Debian

Simply run dpkg-reconfigure tzdata and select the timezone.

FreeBSD

We need to copy or link the timezone file to /etc/localtime:

cp /usr/share/zoneinfo/Pacific/Noumea /etc/localtime
@i-blis
i-blis / better-recipe.md
Last active August 29, 2015 14:01
Install Oracle Java on Debian

Install Oracle Java on Debian

Download

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz

Install

mkdir /opt/jdk

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

@i-blis
i-blis / recipe.md
Created May 25, 2014 19:53
Best practices for ssh access to remote (production) server

Disallowing root access with password authentication

On machines with a single sysadmin where the root account is enabled, it might still be convenient to allow root login through key pairing only by disabling remote password login for root. To this end, /etc/sshd_config should have the fololwing lines:

PermitRootLogin without-password

PubkeyAuthentication yes
@i-blis
i-blis / recipe.md
Created April 12, 2014 22:54
Hints for PostgreSQL use on OS X

Starting and stopping PostgreSQL server

Start, and stop, manually:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl -D /usr/local/var/postgres stop -s -m fast

Or let launchd start the server at login or boot:

#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@i-blis
i-blis / index.js
Created March 29, 2014 10:53
requirebin sketch
var hypotrochoid = require('hypotrochoid')
, d3 = require('d3')
var ranged = range(0, 500, 1)
var points = ranged.map(function(t) {
return hypotrochoid(70, [50, 70, 82.5], t)
})
function range(start, end, inc) {
var a = []
@i-blis
i-blis / _.md
Created March 29, 2014 00:11
movable point on circle
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.