Skip to content

Instantly share code, notes, and snippets.

@nitinthewiz
nitinthewiz / Dockerfile
Created January 23, 2020 18:20 — forked from aurelijusb/Dockerfile
Code snippets for Minsk PHP Night presentation: Headless browsers and friends
FROM ubuntu:latest
RUN apt-get update && \
apt-get install -y xvfb firefox python-pip xdotool x11vnc
RUN apt-get install -y wget
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-linux64.tar.gz
RUN tar zxvf geckodriver-v0.16.1-linux64.tar.gz && mv geckodriver /usr/bin/geckodriver
ENV DISPLAY=:1.0
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<!-- OPML generated by Fever -->
<head><title>Fever</title></head>
<body>
<outline type="rss" text="decoding.io/feed" title="decoding.io/feed" xmlUrl="decoding.io/feed/" htmlUrl=""/>
<outline type="rss" text="aworkinglibrary.com/library/rss" title="aworkinglibrary.com/library/rss" xmlUrl="http://aworkinglibrary.com/library/rss/" htmlUrl=""/>
<outline type="rss" text="blog.hugsformonsters.com/rss" title="blog.hugsformonsters.com/rss" xmlUrl="http://blog.hugsformonsters.com/rss" htmlUrl=""/>
<outline type="rss" text="daverupert.com/feed" title="daverupert.com/feed" xmlUrl="http://daverupert.com/feed/" htmlUrl=""/>
<outline type="rss" text="elliotjaystocks.com/blog/feed" title="elliotjaystocks.com/blog/feed" xmlUrl="http://elliotjaystocks.com/blog/feed/" htmlUrl=""/>
@nitinthewiz
nitinthewiz / weather.rb
Last active July 8, 2018 03:56
weather API for compass
require 'date'
require 'httparty'
require 'json'
MY_COMPASS="https://compass"
COMPASS_LOCATION_READ_TOKEN=""
COMPASS_WEATHER_WRITE_TOKEN=""
DARK_SKY_API=""
data = JSON.parse(HTTParty.get(MY_COMPASS+'/api/last?token='+COMPASS_LOCATION_READ_TOKEN).body)
@nitinthewiz
nitinthewiz / game.js
Created June 12, 2017 19:41
superhex change your server to SA (South Africa)
"use strict";
var superhex = function() {
function e(e) {
return 0 == e ? tn[0] : e == Xt ? tn[(Xt - 1) % (tn.length - 1) + 1] : Xt > 0 && e > Xt ? $e[(e - 2) % $e.length] : $e[(e - 1) % $e.length]
}
function t(e) {
return 0 == e ? nn[0] : e == Xt ? nn[(Xt - 1) % (nn.length - 1) + 1] : e > Xt ? et[(e - 2) % et.length] : et[(e - 1) % et.length]
}
@nitinthewiz
nitinthewiz / json.php
Created June 7, 2017 00:07
trying to create jsonfeed for nitinthewiz/TheLiveblog
<?php
$configs = include('configs.php');
$results = file_get_contents('text.txt');
$feed_items = array();
$wp_comments = eval("return " . $results . ";");
$i=0;
foreach ($wp_comments as $livepost){
if($i==20) break;
@nitinthewiz
nitinthewiz / Asian Music chart HackAPI
Created October 27, 2016 20:01
Steps to get Asian Music chart
Steps to get Asian Music chart
1. Open http://www.bbc.co.uk/asiannetwork/chart/print
2. Fire up jQuerify using https://chrome.google.com/webstore/detail/jquerify/gbmifchmngifmadobkcpijhhldeeelkc
3. Run the below script in the console to get the tbl variable
var tbl = $('table tr:has(td)').map(function(i, v) {
var $td = $('td', this);
return {
id: ++i,
(work-python 2.7)$ pip freeze
Flask==0.9
Jinja2==2.6
PIL==1.1.7
Werkzeug==0.8.3
distribute==0.6.26
gevent==1.0b3
gevent-zeromq==0.2.5
greenlet==0.4.0
ipython==0.12.1
@nitinthewiz
nitinthewiz / app.py
Created October 23, 2016 19:25 — forked from notbanker/app.py
Bayesian calculation for twin Down Syndrome probabilities (Flask app)
from flask import Flask, request, url_for
from scipy.optimize import bisect
import math
import numpy as np
app = Flask(__name__)
app.secret_key = 'Whatever'
@app.route('/')
def index():
@nitinthewiz
nitinthewiz / mplonflask.py
Created October 23, 2016 19:20 — forked from tkf/mplonflask.py
matplotlib on Flask
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
import numpy
from flask import Flask, send_file
from cStringIO import StringIO
app = Flask(__name__)
@nitinthewiz
nitinthewiz / private.xml
Created August 18, 2016 20:26 — forked from DanSkeel/private.xml
Settings for Karabiner to enable Shift+Enter shortcut for newline in Messages app
<?xml version="1.0"?>
<!-- Documentation: https://pqrs.org/osx/karabiner/xml.html.en -->
<root>
<appdef>
<appname>Messages</appname>
<equal>com.apple.iChat</equal>
</appdef>
<item>
<name>Enable Shift+enter newline shortcut in Messages app</name>
<identifier>private.Messages.NewLine</identifier>