Skip to content

Instantly share code, notes, and snippets.

💭
Palm oil. know the facts!

DrGo

💭
Palm oil. know the facts!
View GitHub Profile
View gist:7256f19221472d90ecba44f2c4a0dd7e

Vim for Go development

Vim-go

motions

  • if : select the code inside a function
  • af : select the entire function code including comments

shortcuts

  • gd : go to definition of word under cursor
  • Ctrl-O / Ctrl-I :hop back to your source file/return to definition
  • K : opens documentationn
@DrGo
DrGo / TerminalVim.scpt
Last active Sep 9, 2019 — forked from chaadow/TerminalVim.scpt
open a file in vim within an iTerm2 tab
View TerminalVim.scpt
-- TerminalVim.app
-- This creates a shim Application that will enable you to open files from the Finder in vim using iTerm
-- To use this script:
-- 1. Open Automator and create a new Application
-- 2. Add the "Run Applescript" action
-- 3. Paste this script into the Run Applescript section
-- 4. Save the application as TerminalVim.app in your Applications folder
-- 5. In the Finder, right click on a file and select "Open With". In that window you can set TerminalVim as a default
on run {input, parameters}
@DrGo
DrGo / stata-clearlinux.txt
Last active Aug 11, 2019
installing Stata on clear linux
View stata-clearlinux.txt
Error on running xstata-mp re missing libtinfo.so.5
solution:
sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
@DrGo
DrGo / stat-fake-const.md
Created Mar 17, 2018
Signalling intentions in Stata using fake keywords
View stat-fake-const.md

In Stata, it is possible to create pseudo-keywords to document your intentions. For instance, Stata does not have a way to declare a macro (Stata memory-based variable) as a constant. In many programming languages, there is a keyword, typically const, that signals to the compiler/interpreter, and more importantly to human readers, that this variable should not be changed after its declaration. E.g.,

    const PI = 3.14   //PI is guaranteed not to change during the execution of the program, avoiding subtle bugs

There is no equivalent keyword in Stata, but it can be simulated using this approach:

// In your profile.do, declare a global macro "const" and assign an empty string to it
@DrGo
DrGo / var-manager-tip.md
Last active Mar 17, 2018
Bringing up the variable manager window while using Stata command line
View var-manager-tip.md

If you are like me, when you are using Stata's command window you do not like to switch to using the mouse to bring up the variable manager window whenever, e.g., you want to check the name of a variable.

One solution is assigning the following commands to a certain function key (e.g., F2) and running it every time you load Stata by adding it to your profile.do file.

global F2 : display "varm" _char(13) "sleep 1000" _char(13) "window manage forward command;"

Everytime you press F2, the variable manager window will be displayed for 1 second.

How it works

@DrGo
DrGo / cygwin-mirror-speed.py
Created Jun 24, 2017 — forked from ushkinaz/cygwin-mirror-speed.py
Tests speed of http mirrors of cygwin
View cygwin-mirror-speed.py
#!/usr/bin/env python3
"""
Tests http mirrors of cygwin
"""
import random
import time
from urllib.request import urlopen
import sys
__author__ = 'Dmitry Sidorenko'
@DrGo
DrGo / BetterBibLatexCiteKeyForMarkdown.js
Created Jun 18, 2017 — forked from EoinTravers/BetterBibLatexCiteKeyForMarkdown.js
A modification of BibTexCiteKeyForMarkdown, exporting citations in BetterBibLatex format (i.e. "@TRAVERS2015")
View BetterBibLatexCiteKeyForMarkdown.js
{
"translatorID": "",
"translatorType": 3,
"label": "Better BibLateX key for Markdown",
"creator": "Eoin Travers. Forked from BibTex key for Markdown, created by liob based on the works of Peter O'Brien, Simon Kornblith and Richard Karnesky",
"target": "bib",
"minVersion": "2.1.9",
"maxVersion": null,
"priority": 200,
"inRepository": true,
View app-engine-google-cloud-storage-upload-example.go
package example
import (
"fmt"
"math/rand"
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/file"
"google.golang.org/appengine/log"
View app-engine-google-cloud-storage-upload-example.go
package example
import (
"fmt"
"math/rand"
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/file"
"google.golang.org/appengine/log"
@DrGo
DrGo / README.md
Created Jan 28, 2017 — forked from hofmannsven/README.md
My simply Git Cheatsheet
You can’t perform that action at this time.