Skip to content

Instantly share code, notes, and snippets.

View DrGo's full-sized avatar
💭
Palm oil. know the facts!

DrGo

💭
Palm oil. know the facts!
View GitHub Profile
@DrGo
DrGo / VimScriptForPythonDevelopers.MD
Created October 22, 2023 19:33 — forked from yegappan/VimScriptForPythonDevelopers.MD
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@DrGo
DrGo / README.md
Created November 19, 2022 05:09 — forked from ctsrc/README.md
Guide: Run FreeBSD 13.1-RELEASE for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc) with HVF acceleration (Hypervisor.framework)
@DrGo
DrGo / book-layout-css-grid-flexbox-wip.markdown
Created September 13, 2022 17:57
Book Layout // CSS Grid // Flexbox // WIP

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 September 9, 2019 23:07 — forked from chaadow/TerminalVim.scpt
open a file in vim within an iTerm2 tab
-- 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 August 11, 2019 17:00
installing Stata on clear linux
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 March 17, 2018 18:28
Signalling intentions in Stata using fake keywords

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 March 17, 2018 17:41
Bringing up the variable manager window while using Stata command line

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 June 24, 2017 20:44 — forked from ushkinaz/cygwin-mirror-speed.py
Tests speed of http mirrors of cygwin
#!/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 June 18, 2017 02:51 — forked from EoinTravers/BetterBibLatexCiteKeyForMarkdown.js
A modification of BibTexCiteKeyForMarkdown, exporting citations in BetterBibLatex format (i.e. "@TRAVERS2015")
{
"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,