This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { accessSync, promises as fs } from 'fs'; | |
(async()=>{ | |
const input = await fs.readFile("./interpretertests/aoc_21_5_input.txt", 'utf8') | |
const drawing = (straight) => input.split('\n').reduce((acc, line) => { | |
let [[x1,y1],[x2,y2]] = line.split(' -> ').map(x => x.split(',').map(x => parseInt(x))) | |
if (straight && x1!=x2 && y1!=y2) return acc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { accessSync, promises as fs } from 'fs'; | |
(async()=>{ | |
const input = await fs.readFile("./interpretertests/aoc_21_4_input.txt", 'utf8')+'\n' | |
const lines = input.split('\n') | |
const draw = lines[0].split(',').map(Number) | |
const boards = lines.slice(1).reduce((acc, line)=>{ | |
if (line.trim().length==0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
const fs = require('fs') | |
const TelegramBot = require('node-telegram-bot-api') | |
const token = '<<<< PUT BOT TOKEN HERE >>>>>' | |
const bot = new TelegramBot(token, {polling: true}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import googlemaps | |
gmaps = googlemaps.Client(key='YOUR_KEY') | |
test = gmaps.find_place('nice company', 'textquery') | |
if 'candidates' in test and len(test['candidates'])>0: | |
first = test['candidates'][0]['place_id'] | |
details = gmaps.place(first) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$p = -1; | |
$intr = 2; | |
@minute = (); | |
while(1) { | |
$c = `find ./scraped -size +3k -ls|wc -l`; | |
chomp($c); | |
if ($p>=0) { | |
$t = $c - $p; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const processOutput = (_output, _outputExample) => { | |
Object.keys(_outputExample).forEach((k)=>{ | |
const val = _outputExample[k] | |
if (val != null && Array.isArray(val)) { | |
assert.deepStrictEqual(_output[k], val) | |
} else if (typeof val == 'object' && val != null) { | |
processOutput(_output[k], val) | |
} else { | |
assert.strictEqual(_output[k], val) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On the same server as OpenWhisk with the playground running, add the Nginx config; | |
server { | |
listen 443; | |
listen [::]:443; | |
server_name whisk.server.com; | |
location ~ /api/v1/* { | |
proxy_pass http://172.17.0.1:3233; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
=begin comment | |
Go here: https://www.ofx.com/en-us/forex-news/historical-exchange-rates/ | |
open developer tools in Chrome | |
paste in console; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
%fieldmapping = ( '20'=>'transaction_ref', '25'=>'account_ref', '28C' => 'statement_no', '86'=>'account_owner', | |
'61'=>'amount', '60F' => 'opening_balance', '62F'=>'closing_balance' ); | |
@fieldorder = ($fieldmapping{'20'}, $fieldmapping{'25'}, 'date', $fieldmapping{'28C'}, $fieldmapping{'86'}, | |
'currency', $fieldmapping{'61'}, $fieldmapping{'60F'}, $fieldmapping{'62F'}); | |
$last = ""; | |
$skipline = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program | |
{ | |
int[][] F = new int[8][]; | |
int[][] Op = new int[10][]; | |
int[] Inv = new int[] { 0, 4, 3, 2, 1, 5, 6, 7, 8, 9 }; | |
public Program() | |
{ |