Skip to content

Instantly share code, notes, and snippets.

@HaiNguyen007
HaiNguyen007 / letsencrypt.pem
Created December 26, 2018 03:22 — forked from ntninja/letsencrypt.pem
Let's encrypt certificate chain
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
@HaiNguyen007
HaiNguyen007 / bibtex.png
Created November 28, 2018 08:53 — forked from max-mapper/bibtex.png
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
FROM python:2.7-alpine
MAINTAINER Nick Janetakis <[email protected]>
ENV INSTALL_PATH /bsawf
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY requirements.txt requirements.txt
RUN apk add --no-cache --virtual .build-deps \
@HaiNguyen007
HaiNguyen007 / docker-json-server.sh
Created November 21, 2018 16:14 — forked from jordifebrer/docker-json-server.sh
docker-json-server.sh
#!/usr/bin/env bash
echo '{"cities": [{"name": "Barcelona"}, {"name": "Copenhagen"}, {"name": "Edinburgh"}, {"name": "Hanoi"}]}' > /tmp/cities.json
docker run -d -p 80:80 -v /tmp/cities.json:/data/db.json clue/json-server
# Listing my favourite cities
curl http://localhost/cities
[
{"name": "Barcelona"},
{"name": "Copenhagen"},
@HaiNguyen007
HaiNguyen007 / docker-compose.yml
Created November 21, 2018 16:13 — forked from jordifebrer/docker-compose.yml
Waiting for a webserver container example
version: '3'
networks:
test_net:
services:
webserver:
image: nginx:alpine
command: sh -c 'sleep 10 && nginx -g "daemon off;"'
networks:
- test_net
@HaiNguyen007
HaiNguyen007 / srt2txt.py
Created November 20, 2018 19:07 — forked from mgaitan/srt2txt.py
Convert subtitles to plain text
#!/usr/bin/env python
import sys
import re
import textwrap
def str2txt(srt):
lines = re.sub(r'^$\n|^[0-9].*\n|^\n','', srt, flags=re.MULTILINE | re.UNICODE)
print(textwrap.fill(lines, 70))
if __name__ == '__main__':
@HaiNguyen007
HaiNguyen007 / srt2txt.rb
Created November 20, 2018 18:58 — forked from jnv/srt2txt.rb
Converts SRT subtitles to plain text, strips irrelevant parts. Requires gems: srt, sanitize. Created for Doctor Who text analysis project.
#!/usr/bin/env ruby
require "srt"
require "sanitize"
REJECT_LINES = [/Best watched using Open Subtitles MKV Player/,
/Subtitles downloaded from www.OpenSubtitles.org/, /^Subtitles by/,
/www.tvsubtitles.net/, /[email protected]/, /addic7ed/, /allsubs.org/,
/www.seriessub.com/, /www.transcripts.subtitle.me.uk/, /~ Bad Wolf Team/,
/^Transcript by/, /^Update by /, /UKsubtitles.ru/
]
@HaiNguyen007
HaiNguyen007 / Nature.ipynb
Created November 10, 2018 11:36 — forked from hackjutsu/Nature.ipynb
[Jupyter Notebook Demo 2] This is a #demo for Lepton's support of Jupyter Notebook viewer.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HaiNguyen007
HaiNguyen007 / CopyAsanaTasks.php
Created August 26, 2017 03:32 — forked from AWeg/CopyAsanaTasks.php
main changes: - Asana has own SSL cert -> had to add to lines of code - copies subtasks and up to 11 subtasks of subtasks - copies tags -> only tagnames not followers/descriptions
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@HaiNguyen007
HaiNguyen007 / prepareSheets.js
Created August 2, 2017 21:55 — forked from misterfresh/prepareSheets.js
Add an Update button to the Dashboard for React Drive CMS
// This script is intended for use with https://github.com/misterfresh/react-drive-cms
// Add it as a bound script to the Dashboard Sheet file
function onOpen() {
var dashboard = SpreadsheetApp.getActiveSpreadsheet();
var updateDashboard = [{name: "Update Dashboard", functionName: "prepareSheets"}];
dashboard.addMenu("Update", updateDashboard);
}
function prepareSheets() {
'use strict';
var Preparator = {