Skip to content

Instantly share code, notes, and snippets.

View hem-brahmbhatt's full-sized avatar

Hem Brahmbhatt hem-brahmbhatt

View GitHub Profile
@hem-brahmbhatt
hem-brahmbhatt / log-to-file.lua
Created October 22, 2022 17:27
Print or log to a file in lua using standard lib
-- Log the pattern matching result to a file
logfile = io.open("/tmp/nvim.log", "a")
io.output(logfile)
for _, ignored_buffer in ipairs(config.buffers.ignored_buffers or {}) do
io.write("bufname: "..bufname.."\n")
io.write("ignored-buffer-regex: "..ignored_buffer.."\n")
io.write("match: ", string.match(bufname, ignored_buffer) and "yes" or "no", "\n")
io.write("\n")
# This makefile would be used to run command from circleci
.DEFAULT_GOAL := help
GOSS_VERSION=0.3.6
.PHONY: build
build: ## Builds docker image, ie. IMAGE_NAME=wd-tools MODULE_PATH=wd-tools/ make build
docker build -t $(IMAGE_NAME):node12 $(MODULE_PATH)
.PHONY: test
test: ## Tests image. Execute make build first, ie. IMAGE_NAME=wd-tools MODULE_PATH=wd-tools/ make test
- [x] disable sftp on demo
- [x] test s3 upload in production
- [ ] fix pdf export to ZIP file rather than file name - test after merging https://github.com/elifesciences/elife-xpub/issues/520
- [ ] fix logging of S3 data
- [ ] go over configuration app issue
- [x] set sandbox to false for production
- [x] set NODE_CONFIG_ENV on environments and create config files
- [x] test NODE_CONFIG_ENV overrides NODE_ENV
- [x] ensure this is the preferred approach for public config over using NODE_CONFIG and updating 3 repositories
- [ ] create a single configuration method for environment variables - pick between custom-environment-variables.js and NODE_CONFIG
@hem-brahmbhatt
hem-brahmbhatt / web-servers.md
Created November 7, 2017 14:38 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

Keybase proof

I hereby claim:

  • I am damnhipster on github.
  • I am damnhipster (https://keybase.io/damnhipster) on keybase.
  • I have a public key whose fingerprint is 28CB 6BAB F841 68D2 12B6 9362 F0CA 795F 0E38 7A10

To claim this, I am signing this object:

import random
from locust import HttpLocust, TaskSet
articleIds=[
"/news/3587594/article-without-images-for-customiser-test/",
"/news/3566576/rhys-jones-parents-split-little-boy-blue/",
"/news/3566887/pigs-trotter-door-muslim-community-centre/",
"/news/2521928/new-laws-cigarette-tobacco-smoking-plain-packaging/",
"/news/3382947/rhys-jones-brother-owen-little-boy-blue/",
"/news/3566733/ufc-champion-michael-bisping-refused-to-sign-new-contract-with-management-after-suffering-death-threats-and-bullying/",
{
"name": "hafton",
"version": "1.0.0",
"description": "site furniture",
"main": "index.js",
"scripts": {
"prebuild": "rm -rf build/* && mkdir -p build/src/assets",
"build": "run-p templates css js images:copy fonts:copy",
"build:watch": "watch 'npm run build' src/",
<template>
  <div id="app">

    <div class="loading-spinner-overlay on-load " v-doneloading="sharedState.isLoading" style="display: block">
        <div class="loading-spinner-large"><div></div></div>
    </div>
    <div id="site-furniture-scripts"></div>

    <siteheader></siteheader>
#!/usr/bin/env bash
shopt -s extglob
set -o errtrace
set -o errexit
rvm_install_initialize()
{
DEFAULT_SOURCES=(github.com/rvm/rvm bitbucket.org/mpapis/rvm)
@hem-brahmbhatt
hem-brahmbhatt / whislist.md
Last active October 5, 2015 09:13
Library wishlist
  • config.js: A library which can parse JSON, XML, YAML, .properties and other formats
  • perfanimate: Smooth animation library. Maybe contain helpers or just a pattern to follow to make animations run at 60fps across devices velocity.js is the one to use
  • crowser: Cross-browser library to read/listen on standardised CSS and JS events
  • pazguille/viewport to change viewport metatag properties, such as zoom