Skip to content

Instantly share code, notes, and snippets.

I will be slow to respond.

Samantha Demi samdmarshall

I will be slow to respond.
View GitHub Profile
samdmarshall /
Last active Apr 1, 2021
unable to get a list of staged files via pygit2


i am trying to create a prepare-commit-msg hook that will automatically populate and format my commit messages into an org document that has a level 1 heading for each staged file in the commit. so for example, this is one i did by hand, but basically like this: where each staged file has it’s own heading and is tagged according to the status of that staged file. so when i’m finished in my commit editor, the contents of my .git/COMMIT_EDITMSG looks like this:

#+title: @ develop
#+author: <git.config[""]>
#+email: <git.config[""]>
#+date: <timestamp of running =git commit=>
cutting a new release
View example2v2.nim
# =======
# Imports
# =======
import json
import strformat
import asyncdispatch
import threadproxy
View example2.nim
# =======
# Imports
# =======
import json
import strformat
import asyncdispatch
import threadproxy
View example1.nim
# =======
# Imports
# =======
import json
import strformat
import asyncdispatch
import threadproxy
View code.swift
// Intention: query a dictionary for a key-value pair, take the value as a path that needs to be expanded (tilde -> abspath)
// and then make it available to use.
let path_value = arguments["path"] ?? "" // the `?? ""` makes this a `String` and not an `Any`
var path = NSString.init(string:"\(keychain_path_value)") // this will accept an `Any` or a `String` as the type to
// subsitute when creating the `NSString` type object
if !path.isEqual(to:"") { // "if the string has contents, then expand the path"
path = path.expandingTildeInPath as NSString // cast `as NSString` is necessary because it returns a `String`
View installing tor on OS

Install Homebrew

Installation instructions: here

Install Tor

$ brew install tor

Enabling the default config file

sudo mv /usr/local/etc/tor/torrc.sample /usr/local/etc/tor/torrc

Setup Automatic SOCKS proxy

View building_for_ios.cmake
View gist:582ef33ca1ae6f700ea2ef9723ef6ad8
+-o repo-root/
+-o android/
+-o core/
| +-o lib/
| +-o json/
| +-o json.cpp
| +-o json.hpp
| +-o test.cpp
+-o ios/
| +-o Podfile
View list
# so instead of doing this:
my_list = list()
for key in dictionary:
if dictionary[key] == 'foo':
# you can use list comprehension to write code like this:
my_list = [key for key in dictionary if dictionary[key] == 'foo']
# both produce the same list of keys, but i think that using list comprehension is a lot more readable.
samdmarshall / # mercurial - 2016-08-16_09-12-46.txt
Created Aug 16, 2016
mercurial on Mac OS X 10.11.6 - Homebrew build logs
View # mercurial - 2016-08-16_09-12-46.txt
Homebrew build logs for mercurial on Mac OS X 10.11.6
Build date: 2016-08-16 09:12:46