Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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"},
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 / 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
@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
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
! apt-get install -qq -o=Dpkg::Use-Pty=0 openssh-server pwgen > /dev/null
#Set root password
@HaiNguyen007
HaiNguyen007 / tmux-cheatsheet.markdown
Created January 9, 2019 08:01 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname