Skip to content

Instantly share code, notes, and snippets.

View sim642's full-sized avatar

Simmo Saan sim642

View GitHub Profile
@sim642
sim642 / aoc2018-day20-tree.txt
Created December 20, 2018 14:35
Advent of Code 2018 day 20 regex AST tree
.SWWNNWNNESENNWWNWSSWSWWWSEEEE
.|N
.|.SSWWSSESSSEENNESSEEEENENEEENWNWSWWWS
.|.|.WW
.|.|.|SEEWWN
.|.|.|
.|.|.NEN
.|.|.|.WWW
.|.|.|.|NN
.|.|.|.|.W
@sim642
sim642 / HTTPS_rant.md
Last active February 21, 2018 15:26
HTTPS is Dangerous vol 2, aka webdev view

HTTPS is Dangerous vol 2, aka webdev view

A less-sensational and less-conspiratory follow-up to [Bryan Lunduke's "HTTPS is Dangerous"][lunduke].

Introduction

While Lunduke focuses on numerous high-level and theoretical issues with HTTPS, which are very controversial, this writing rant looks at actual practical issues regarding HTTPS advocacy and adoption. It is mainly from the point of view of a web application developer, who make up a fraction of web users, but also gives insight into related average user experience. I am basing this off of my own (probably somewhat unique) experiences during a project regarding the topic as there isn't similar discussion elsewhere.

My webapp

I don't consider myself a web developer, let alone a professional one; in fact I despise webdev for many reasons, including the ones discussed below. Nevertheless, a side project of mine, for now ~8 months (on and off), has been a [small webdev project][einstein-js] (referred to as "my webapp" below). **It is a purely

public class Ch5_q7 {
public static void main(String[] args) {
int[] mateArray = new int[21];
int counter = 1, starter = 1;
mateArray[0] = 0;
while (counter < 21) {
if (starter != dividerSum(starter) && starter == dividerSum(dividerSum(starter))) {
if (starter != mateArray[counter-1]) {
mateArray[counter] = starter;
mateArray[counter+1] = dividerSum(starter);
@sim642
sim642 / ArrayUtils.java
Last active May 15, 2016 16:12
Lexicographical array comparison
public final class ArrayUtils {
private ArrayUtils() {
}
public static <T extends Comparable<T>> int compare(T[] arr1, T[] arr2) {
int length = Math.min(arr1.length, arr2.length);
for (int i = 0; i < length; i++) {
int compare = arr1[i].compareTo(arr2[i]);
if (compare != 0)
@sim642
sim642 / nio-refactor.diff
Last active May 9, 2016 11:43
diff of refactoring Java NIO into shy, produced by shy, after importing git repository to shy
--- /src/main/java/ee/shy/cli/command/AddCommand.java
+++ /src/main/java/ee/shy/cli/command/AddCommand.java
@@ -2,21 +2,21 @@
import ee.shy.cli.Command;
import ee.shy.cli.HelptextBuilder;
import ee.shy.core.Repository;
-import java.io.File;
import java.io.IOException;
@sim642
sim642 / simLCD.cpp
Created April 10, 2016 17:09
Arduino library for Nokia 5110 screen with complete buffer support
#include "simLCD.h"
simLCD::simLCD()
{
clear();
}
simLCD& simLCD::setSCLK(int pin)
{
pinSCLK = pin;
@sim642
sim642 / kang.cpp
Created November 24, 2013 11:13
EIO lahtine võistlus 2013
#include <fstream>
using namespace std;
int main()
{
ifstream fin("kangsis.txt");
ofstream fout("kangval.txt");
int L, N;
from fractions import gcd
from random import randint
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
@sim642
sim642 / simbot.js
Last active December 19, 2015 05:09
Source for simbot aka swagbot
var irc = require("irc");
var fs = require("fs");
var swag = {};
var cangive = {};
var cangive2 = {};
/*var regex = /^\s*([a-z_\-\[\]\\^{}|`][a-z0-9_\-\[\]\\^{}|`]*)[\s,:]*(\+\+|--)$/i*/
var regex = /^\s*([a-z_\-\[\]\\^{}|`][a-z0-9_\-\[\]\\^{}|`]*)[\s,:]*(\+\+)$/i
process.stdin.resume();
@sim642
sim642 / init.cpp
Last active December 13, 2015 20:48
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cctype>
using namespace std;
class Trie
{