Skip to content

Instantly share code, notes, and snippets.

# Within models.ts
# With `Foo`
Cannot find name 'Foo'
# With `Foo.Foo`
Cannot find namespace 'Foo'
import yaml
import logging
from logging.config import dictConfig as _dictConfig
def _get_logger():
with open('logging.yml', 'rt') as f:
data = yaml.load(f)
_dictConfig(data)
return logging.getLogger()
from setuptools import setup, find_packages
from os import path, listdir
from functools import partial
from pip import __file__ as pip_loc
if __name__ == '__main__':
package_name = 'foo'
f_for = partial(path.join, path.dirname(__file__), package_name)
d_for = partial(path.join, path.dirname(path.dirname(pip_loc)), package_name)
#!/usr/bin/env bash
first_run=${first_run:-false}
host=${host:-domain.com}
conf=${conf:-'static_sites.conf'}
ssh_cmd=${ssh_cmd:-'ssh}'
curr_user=${curr_user:-'dokku'}
new_user=${new_user:-'static'}
if [ ! -z "$new_pass" ]; then
cmake_minimum_required(VERSION 3.5)
project(foo_proj)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(SOURCE_FILES main.cpp)
add_custom_command(
OUTPUT bar.h
COMMAND echo \#define bar 10 > bar.h
DEPENDS main.cpp
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonObjectRequest;
import org.json.JSONException;
import org.json.JSONObject;
// verror is what the restify errors inherit from
// see: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/verror/index.d.ts#L20
// see: https://github.com/restify/errors
import { RestError } from 'restify';
import { inherits } from 'util';
import { GenericErrorArgs, ICustomError } from 'restify-errors';
import * as verror from 'verror';
import VError = require('verror');
class RestErrorBase extends Error implements VError {
#!/usr/bin/env bash
# Returns true if git needs to be updated; false otherwise
function update_git() {
pushd "$1"
git remote update
if [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \
sed 's/\// /g') | cut -f1) ]; then
res=0;
CREATE /*TEMPORARY*/ TABLE IF NOT EXISTS mongorestore_tbl (
block_id VARCHAR(33) PRIMARY KEY,
exam VARCHAR(33),
children TEXT
) DEFAULT CHARSET=utf8;
CREATE /*TEMPORARY*/ TABLE IF NOT EXISTS study_tbl (
course_id VARCHAR(33),
student_id VARCHAR(33),
id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY
CREATE TABLE zero_tbl (
block_id VARCHAR(33) PRIMARY KEY,
exam VARCHAR(33),
cat VARCHAR(33),
par_cat VARCHAR(33),
children TEXT
);
INSERT INTO zero_tbl VALUES
('block0', 'exam0', 'cat0', 'cat0', 'block2:block3'),