Skip to content

Instantly share code, notes, and snippets.

View engineervix's full-sized avatar
🎯
Focusing

Victor Miti engineervix

🎯
Focusing
View GitHub Profile
@engineervix
engineervix / mkdown2html_and_pdf.py
Last active April 2, 2023 14:09
convert markdown to html and pdf using Python
import markdown2 # pip install markdown2
import os
import sys
import pdfkit # for pdf output (uses wkhtml2pdf, which must be in your PATH)
# adapted from http://is.gd/yetava
# usage: python mkdown2html_and_pdf.py input.md your_custom_stylesheet.css
DEFAULT_EXTRAS = [
'fenced-code-blocks',
@engineervix
engineervix / md_to_docx.sh
Created July 15, 2015 06:58
Concvert Markdown to Docx (with reference document to copy custom styles) Using Pandoc
pandoc -f markdown -t docx --reference-docx path/to/reference-document.docx my-input-markdown.md -o my-output-document.docx

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@engineervix
engineervix / letsencrypt_2017.md
Created October 1, 2017 23:09 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@engineervix
engineervix / fix-venv.sh
Created October 4, 2017 00:31 — forked from pv8/fix-venv.sh
Fix virtualenv symlinks after upgrading python with Homebrew and running brew cleanup
#!/usr/bin/env bash
#
# Fix virtualenv symlinks after upgrading python with Homebrew and then running
# `cleanup`.
#
# After upgrading Python using Homebrew and then running `brew cleanup` one can
# get this message while trying to run python:
# dyld: Library not loaded: @executable_path/../.Python
# Referenced from: /Users/pablo/.venv/my-app/bin/python
# Reason: image not found
@engineervix
engineervix / build.sh_output.log
Last active October 11, 2017 05:15
console output from NativeScript docs build.sh (https://github.com/NativeScript/docs/issues/920)
NativeScript@ /vagrant/NativeScript
└── markdown-snippet-injector@0.2.2
Extracting snippets from: tests
Processing source file: tests/hooks/after-install/after-install.js
Processing source file: tests/app/TKUnit.ts
Processing source file: tests/app/app/app.ts
Processing source file: tests/app/app/mainPage.ts
Processing source file: tests/app/app/pageNavigation.ts
Processing source file: tests/app/app/style_props.ts
@engineervix
engineervix / hyperref_snippet.tex
Created April 16, 2018 09:55
LaTeX hyperref package snippet
\usepackage[hidelinks,pdftex,pdfpagelabels,unicode]{hyperref}
\hypersetup{%the recommended way of setting up hyperref
%colorlinks=false,%
verbose=true,
psdextra,
pdfdisplaydoctitle=true,
plainpages=false,
bookmarksnumbered,
linkcolor=Sienna,%
citecolor=Sienna,%
@engineervix
engineervix / nginx.conf
Created January 6, 2019 19:08 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@engineervix
engineervix / index.html
Created January 8, 2020 19:23
Electricity Tariff Calculator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="description" content="" />
<meta name="author" content="" />
@engineervix
engineervix / make_dirs_if_not_exists.py
Created January 28, 2020 20:36
create directories if they don't exist
import os
d = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
out_dir = os.path.join(d, "dir_name")
os.makedirs(out_dir, exist_ok=True)