Skip to content

Instantly share code, notes, and snippets.

Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
metacritical / random_sentence.rb
Last active Jul 12, 2021
Create a text file with random sentences of a specific size in bytes.
View random_sentence.rb
#Create a random sentence file of spcified size.
#Usage : ruby sentence.rb 100000000 #In bytes.
words =' ')
maxsize = ARGV[0].to_i || 10000000000
current_size = 0
f ='testfile.txt', 'a')
char = %w(| / - \\).cycle
while current_size < maxsize
metacritical / router.clj
Created May 27, 2021 — forked from borkdude/router.clj
Small ring router using core.mach in babashka
View router.clj
(require '[clojure.core.match :refer [match]]
'[clojure.string :as str]
'[hiccup2.core :refer [html]]
'[org.httpkit.server :as server])
(defn router [req]
(let [paths (vec (rest (str/split (:uri req) #"/")))]
(match [(:request-method req) paths]
[:get ["users" id]] {:body (str (html [:div id]))}
:else {:body (str (html [:html "Welcome!"]))})))
View *nokogiri-commandline-ref.txt
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open(''))
# Do funky things with it using Nokogiri::XML::Node methods...

Configuring Emacs for react, es6, and flow

For a while, JSX and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.

This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.

Set up web-mode

web-mode provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.

metacritical /
Last active Oct 31, 2020 — forked from ibraheem4/
Installing Postgres via Brew (OSX)

Installing Postgres via Brew (Read From below for issues)


Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
metacritical / cprint.clj
Created Aug 4, 2019 — forked from kocubinski/cprint.clj
ClojureCLR println with colors in Windows cmd.exe
View cprint.clj
(assembly-load "ClojureClrEx")
(ns clync.core
(:use [clojure.clr.pinvoke :only [dllimports]]))
(GetStdHandle IntPtr [Int32])
(SetConsoleTextAttribute Boolean [IntPtr UInt32]))
metacritical / handle-escape-opentk.clj
Last active Jul 30, 2019
Inherit GameWindow using proxy and Override OnUpdateFrame method.
View handle-escape-opentk.clj
(ns core
(assembly-load-from "./extern/OpenTK/lib/net20/OpenTK.dll")
(import [System]
metacritical / core-import.clj
Last active Jul 29, 2019
Creating The Game window.
View core-import.clj
(ns core
(assembly-load-from "./extern/OpenTK/lib/net20/OpenTK.dll")
(defn -main[]
(Console/WriteLine "Starting OpenTK Window."))
metacritical / core.clj
Last active Jul 29, 2019
Clojure-CLR Hi World!
View core.clj
(ns core
(import [System])
(defn -main[]
(System.Console/WriteLine "Hi World"))
metacritical /
Last active Jul 30, 2019
Clojure-CLR build script for hi world.
CLOJURE_COMPILE_PATH=build/ $runtime $cljcomp core