Skip to content

Instantly share code, notes, and snippets.

Andrei Neculau andreineculau

Block or report user

Report or block andreineculau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andreineculau / 1.original.ts
Last active Oct 7, 2019
original, simpler, proper --- typing isn't everything
View 1.original.ts
// Usage:
// let observe = InsularObserver(MutationObserver);
// observe(document.documentElement, options, function(documentElementEntry) {...});
import keyMaster = require('key-master')
andreineculau / init.el
Last active Sep 20, 2019
fast emacs startup -- add the following to the beginning of your init.el
View init.el
;; fast startup time
(setq gc-cons-threshold most-positive-fixnum)
(defvar original-file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
(add-hook 'emacs-startup-hook
#'(lambda () (setq gc-cons-threshold 800000
file-name-handler-alist original-file-name-handler-alist)))
;; (add-hook 'emacs-startup-hook
(add-hook 'after-init-hook
(lambda ()
andreineculau /
Last active May 3, 2019
if defense of being old and grumpy
andreineculau / imessage
Created Jan 2, 2019 — forked from aktau/imessage
Send iMessage from the commandline
View imessage
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit
-- another way of waiting until an app is running
on waitUntilRunning(appname, delaytime)
repeat until my appIsRunning(appname)
tell application "Messages" to close window 1
delay delaytime
end repeat
andreineculau / lsof.rb
Last active Jul 21, 2018
Fix homebrew lsof.rb
View lsof.rb
class LsofDownloadStrategy < CurlDownloadStrategy
def stage
safe_system "/usr/bin/tar", "xf", "#{name}_#{version}_src.tar"
cd "#{name}_#{version}_src"
class Lsof < Formula
desc "Utility to list open files"
andreineculau / get-aws-cli-sts.js
Created Dec 22, 2017
fucking get aws-sdk-js to read your aws-cli assumed role
View get-aws-cli-sts.js
import aws from 'aws-sdk';
import fs from 'fs';
import ini from 'ini';
import path from 'path';
// compatibility with aws-cli
let cliCacheFolder = path.join(process.env.HOME, '.aws', 'cli', 'cache');
let awsProfile = process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE;
if (awsProfile) {
try {
andreineculau / pnpmfile.js
Created Sep 18, 2017
pnpmfile.js to lock js-beautify to 1.6.4 across all dependencies as a workaround to
View pnpmfile.js
let semver = require('/usr/local/lib/node_modules/npm/node_modules/semver');
let lockJsBeautifier = function(name, version, {deps, _depsName, pkg}) {
if (name !== 'js-beautify') {
if (!semver.satisfies('1.7.0', version)) {
andreineculau /
Last active Sep 18, 2017
List package.json dependencies' licenses recursively - stdout has the license text, stderr has the list
#!/usr/bin/env bash
# Usage path/to/ node_modules
function jqq() {
jq -r "$@" 2>/dev/null
function grepq() {
grep -q -w "$@" 2>/dev/null
View elementsFromPoint.js
let elementsFromPoint = function(x, y) {
let items = [];
let element;
do {
element = document.elementFromPoint(x, y);
if (!element || element === (items[0] || {}).element) {
You can’t perform that action at this time.