Skip to content

Instantly share code, notes, and snippets.

@newz2000
newz2000 / vtt-to-script.sh
Created January 19, 2018 18:57
Create a script from vtt files
#!/bin/bash
for i in *.vtt
do
cat "${i}" | grep -v ' -->' | grep -v -e '^$' > "${i}.txt"
done
for i in *.txt
do
echo "${i}" >> Script.txt
// it's cool that ES6 allows more unicode characters in variable names, but
// in which version of ES will this be a valid JS variable name?
var TH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ = 3;
// from the famous response on parsing html with regex
// http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
<!DOCTYPE html>
<html>
<head>
<script src="https://fb.me/react-0.13.3.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<title>My First React File</title>
</head>
<body>
<div id="content"></div>
Air2:Fun matt$ mkdir test
Air2:Fun matt$ cd test
Air2:test matt$ ls
Air2:test matt$ php -S localhost:8000
PHP 5.4.24 Development Server started at Sun Apr 27 15:34:56 2014
Listening on http://localhost:8000
Document root is /Users/matt/Developer/Fun/test
Press Ctrl-C to quit.
[Sun Apr 27 15:35:01 2014] ::1:55711 [404]: / - No such file or directory
[Sun Apr 27 15:35:01 2014] ::1:55712 [404]: /favicon.ico - No such file or directory
@newz2000
newz2000 / views.js
Created July 6, 2013 21:57
site-wide context variables for Express apps
// the route is defined
app.get('/notices', ensureLoggedIn('/'), routes.notices);
// these variables should be available from the template even if not explicitly returned
user = getLoggedInUser();
activeNavigation = getCurrentPage();
// some old view
exports.notices = function (req, res) {
var notices = getNotices();
# GITLAB
# Maintainer: @randx
# App Version: 2.9
upstream gitlab {
server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen 192.168.x.x:80;
#
# PRODUCTION
#
production:
adapter: mysql2
encoding: utf8
host: mysql.yourserver.com
reconnect: true
database: gitlab
pool: 5
# # # # # # # # # # # # # # # # # #
# Gitlab application config file #
# # # # # # # # # # # # # # # # # #
#
# 1. Common settings
# ==========================
# Web application specific settings
web:
@newz2000
newz2000 / app.py
Created March 1, 2013 14:44
This gist demonstrates the use case for fhurl pull request #2 https://github.com/amitu/fhurl/pull/2
from importd import d
@d("/")
def index(request):
return "home.html", {'title': 'Hello world!'}
@d("/api/")
def api(request):
context = {'title': 'api', 'me': 1}
if request.is_ajax():