Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
@T1T4N
T1T4N / send_mixpanel_event.sh
Created October 10, 2017 08:37
Send a mixpanel event from bash
#!/usr/bin/env bash
send_mixpanel_event() {
local token="<TOKEN>"
local distinct_id="<DISTINCT-ID>"
local time_now=$(date +%s)
local event
read -d '' event <<-EOF
{
"event": "Install",
@T1T4N
T1T4N / home_row_navigation_finder.json
Last active October 20, 2017 10:00
Home row navigation for Finder using Karabiner Elements
{
"title": "Home row navigation for Finder",
"rules": [
{
"description": "Use right ⌘ +j/k to go down/up in Finder",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "j",
@T1T4N
T1T4N / home_row_arrows.json
Last active October 20, 2017 09:47
Home row as arrows using Karabiner Elements
{
"title": "Home row cursor",
"rules": [
{
"description": "Change fn + H/J/K/L to Arrow Keys",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "h",
@T1T4N
T1T4N / makej.sh
Created November 13, 2017 08:44
Multithreaded make on macOS
local NUM_OF_THREADS=$(sysctl hw.ncpu | awk '{print $2}')
local MAKEOPTS="${MAKEOPTS:-} -j${NUM_OF_THREADS}"
make $MAKEOPTS clean
@T1T4N
T1T4N / is_array_declared.sh
Created November 16, 2017 13:52
Snippet to check if an array is declared
#!/bin/bash
#DEST_DIRS=("" "")
if [[ -z ${DEST_DIRS[*]+_} ]]; then
DEST_DIRS=(
"dir1"
"dir2"
)
fi
@T1T4N
T1T4N / prevent_glob_rm.sh
Last active November 28, 2017 14:44
Command that adds a "-i" file in every subdirectory to prevent "rm -rf *" expansion
# rm -rf * will treat -i as an option and ask for deletion
find . -maxdepth 1 -type d -iname "*" -exec touch {}/-i \; -exec chflags hidden {}/-i \;
@T1T4N
T1T4N / example.pro
Created January 17, 2018 14:57
Conan test_package qt pro file
!exists($$OUT_PWD/conanbuildinfo.pri) {
error("No conanbuildinfo.pri file found")
}
TEMPLATE = app
CONFIG -= app_bundle
#CONFIG -= qt
CONFIG += qt
@T1T4N
T1T4N / conanfile.py
Created January 17, 2018 14:58
Conan test_package example qt conanfile
from conans import ConanFile, tools
import os
class MyaccountTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch", "os_build", "arch_build"
generators = "qmake"
exports="*"
def build(self):
self.run('echo %s' % os.environ["QT_ROOT"])
@T1T4N
T1T4N / print_indent_multiline.py
Created January 19, 2018 12:38
Python snippet to indent a variable that might possibly be multiline
import textwrap
print(textwrap.indent(repr(output_var), " " * 4))
@T1T4N
T1T4N / svimrc.vim
Last active February 8, 2018 07:35
sVimrc
set smoothscroll
let scrollstep = 70
let scrollduration = 25
let hintcharacters = "sadfjklewcmpgh"
" let mapleader = "space"
map "space" "<Leader>"
map "e" toggleReader
" unmap "space"
" unmap "shift+,"