Skip to content

Instantly share code, notes, and snippets.

@KPCCoiL
KPCCoiL / topprover.sh
Last active December 12, 2019 11:28
better one
#!/bin/bash
temporary='.topprover-tool'
cookie="$temporary/cookie.txt"
problem="$temporary/id.txt"
curl="curl -b $cookie"
topprover='https://top-prover.top'
function make_tmpdir() {
if [ ! -d $temporary ]; then
@KPCCoiL
KPCCoiL / topprover.sh
Created November 4, 2019 13:38
Super rough stuff with no security consideration
#!/bin/sh
COOKIE="cookie.txt"
CURL="curl -b $COOKIE"
TOPPROVER='https://top-prover.top'
cat <<EOF > Makefile
login:
curl -X POST -F 'user=$TOPPROVER_USER' -F 'password=$TOPPROVER_PASSWORD' $TOPPROVER/login -c $COOKIE
@KPCCoiL
KPCCoiL / fizzbuzz.asm
Created September 7, 2019 08:48
nasm fizzbuzz
section .data
fizz db "Fizz"
buzz db "Buzz"
newline db 10
section .bss
digits resb 32
section .text
global _start
@KPCCoiL
KPCCoiL / chian-go-down.fish
Created August 6, 2019 13:48
generate moving gifs from any 64x64 pic
function dir-opt
set fmt
set sig
switch $argv[1]
case left
set fmt "+%d+0"
set sig '(-1)'
case right
set fmt "+%d+0"
set sig 1
@KPCCoiL
KPCCoiL / which-is-common.p6
Created January 6, 2019 12:54
script to figure out which English expression is common
#! /usr/bin/env perl6
use v6.c;
use HTTP::UserAgent;
use XML::Document;
use HTML::Parser::XML;
sub get-popularity($user-agent, $phrase) {
my $url = 'https://www.google.com/search?lr=lang_en&as_epq=' ~ $phrase.subst(' ', '+', :g);
my $response = $user-agent.get($url);
my $parser = HTML::Parser::XML.new;
@KPCCoiL
KPCCoiL / tsp.go
Created August 26, 2016 04:07
2-opt for TSP in Go
package tsp
import (
"math"
"math/rand"
"time"
)
type Point struct {
X, Y float64
(module-compile-options main: #t)
(module-extends javafx.application.Application)
(import (class javafx.stage Stage)
(class javafx.scene Scene)
(class javafx.scene.layout StackPane)
(class javafx.scene.control Button)
(class javafx.application Application))
(define (start (stage :: Stage))
(let* ((btn (Button
#!/bin/zsh
#usage : ./runner.zsh 'execution command' problem-id
COMMAND=$1
PROBLEMID=$2
for i in {1..5}; do
INFILE="2015-yo-t$PROBLEMID-in$i.txt"
OUTFILE="2015-yo-t$PROBLEMID-out$i.txt"
\documentclass[a4j]{jsarticle}
\makeatletter
\def\eratos#1 {{%
\newcount \eratos@i \relax
\eratos@i = 1 \relax
\@whilenum\eratos@i<#1\do{%
\@namedef{eratos@isprime\the\eratos@i}{1} \relax
\advance \eratos@i 1 \relax
}%
@KPCCoiL
KPCCoiL / core.clj
Created August 5, 2015 23:44
fx-clj version of ScalaFXHelloWorld
(ns fxtest.core
(:require [fx-clj.core :as fx]))
(import (javafx.scene.paint Color LinearGradient Stop CycleMethod)
(javafx.geometry Insets)
(javafx.scene.effect DropShadow))
(defn create-view []
(fx/h-box
{:style "-fx-background-color: #000000"