Skip to content

Instantly share code, notes, and snippets.

View fmnoise's full-sized avatar
🇺🇦

fmnoise

🇺🇦
  • Yellowpay Inc
  • Norway
View GitHub Profile
@fmnoise
fmnoise / submit.md
Created September 14, 2018 10:40 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@fmnoise
fmnoise / README.md
Created August 21, 2018 08:41 — forked from mfikes/README.md
Seeing the inferred type of a ClojureScript expression

If you are curious about the types inferred by ClojureScript, it is easy to get some insight using a macro:

(defmacro inferred-type [form]
  `'~(cljs.analyzer/infer-tag &env
       (cljs.analyzer/no-warn (cljs.analyzer/analyze &env form))))

This is the kind of dev-time macro you could refer using the new user.cljs feature.

@fmnoise
fmnoise / datomic-reset-attributes.clj
Created August 9, 2018 20:18 — forked from favila/datomic-reset-attributes.clj
Datomic transaction functions to "reset" attributes: i.e. make them have a post-transaction value you specify without having to enumerate the retractions.
(def tx-fns
[{:db/ident :db.fn/reset-attribute-values
:db/doc "Transaction function which accepts an entity identifier, attribute identifier
and set of values and expands to any additions and retractions necessary to
make the final post-transaction value of the attribute match the provided
values. Attribute values must be scalars.
If multiple values are provided on a cardinality-one attribute you will get a
datom conflict exception at transaction time."
:db/fn (d/function
@fmnoise
fmnoise / cljs-graaljs.md
Created July 19, 2018 08:53 — forked from mfikes/cljs-graaljs.md
Try ClojureScript Graal.js

First, you need to install GraalVM and set things up so that the java installed with GraalVM is picked up in your path. See http://www.graalvm.org for more details.

With that in place, you can manage the Truffle languages installed.

Here you can see that I've already installed Python and Ruby:

$ gu list
ComponentId              Version             Component name
@fmnoise
fmnoise / imgUrlToBase64Str.clj
Created June 27, 2018 20:03 — forked from miguelbermudez/imgUrlToBase64Str.clj
Image URL to Base64 String in Clojure
;; REPL ONLY
;; Require clj-http https://github.com/dakrone/clj-http/
(require '[clj-http.client :as client])
;; Import Apache Common's Base64 encoder/decoder
(import (org.apache.commons.codec.binary Base64))
(def test-file
;Image Credit Metropolitan Museum of Art
(client/get "http://images.metmuseum.org/CRDImages/ma/web-large/DP241865.jpg" {:as :byte-array}))
@fmnoise
fmnoise / gist:60fe29ca74fb96b07a875bf579827249
Created June 9, 2018 18:12 — forked from terjesb/gist:4257641
iTerm2 emacs 24.2.1 -nw with paredit on OS X 10.8 Norwegian layout
iTerm2 emacs 24.2.1 -nw with paredit on OS X 10.8 Norwegian layout
Left Command is my Meta.
Left Alt used for inputting special characters.
Caps Lock is mapped to Control.
 > System Preferences > Keyboard > Keyboard > Special: Caps Lock: ^ Control
iTerm > Preferences > Keys: Left Command key mapped to Right Option
iTerm > Preferences > Profiles > Keys: Right option acts as: +Esc
@fmnoise
fmnoise / README.md
Created April 27, 2018 10:11 — forked from bhb/README.md
Clojure friendly mode, inspired by https://github.com/slipset/friendly
@fmnoise
fmnoise / README.md
Created April 27, 2018 10:11 — forked from bhb/README.md
Clojure friendly mode, inspired by https://github.com/slipset/friendly

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@fmnoise
fmnoise / unbind.js
Created December 27, 2017 11:17 — forked from cowboy/unbind.js
JavaScript: Function.prototype.unbind (for @jugglinmike)
Function.prototype.bind = (function(origBind) {
return function() {
var fn = origBind.apply(this, arguments);
fn.__origFn__ = this.__origFn__ || this;
return fn;
};
}(Function.prototype.bind));
Function.prototype.unbind = function() {
return this.__origFn__;