Skip to content

Instantly share code, notes, and snippets.

Avatar

Jukka Aho ahojukka5

View GitHub Profile
View lucky.py
import ctypes
import os
import subprocess
import tempfile
__code__ = """
#include <stdbool.h>
bool check(unsigned long long int n) {
int sum = 0;
@ahojukka5
ahojukka5 / README.md
Created Feb 24, 2021
Prosesseja, prosesseja
View README.md
16:59 $ ps aux |grep main_static
jukka     686308  0.0  0.0   1072     8 pts/9    S+   17:00   0:00 ./main_static
jukka     686314  0.0  0.0   1072     8 pts/12   S+   17:01   0:00 ./main_static
jukka     686324  0.0  0.0  11572   740 pts/11   S+   17:01   0:00 grep --color=auto main_static
@ahojukka5
ahojukka5 / vector2.c
Last active Feb 21, 2021
ccall julia
View vector2.c
#include <stdlib.h>
#include <stdio.h>
// gcc -shared -o vector2.so vector2.c
typedef struct Vec {
long int length;
double* data;
} Vec;
@ahojukka5
ahojukka5 / surffailija.py
Last active Feb 8, 2021
Satunnainen surffailija surffailee netissä miljoona kertaa
View surffailija.py
import random
random.seed(0)
# Mille sivuille voi päätyä miltäkin sivulta
G = {
"A": ("B", "C", "D"),
"B": ("C", "D"),
"C": ("A",),
"D": ("A", "C")
}
@ahojukka5
ahojukka5 / docker-image-size-comparison.md
Created Jan 3, 2021
Docker file sizes with different strategies
View docker-image-size-comparison.md

Docker file sizes

Test image is alpine, size of image is 5.58MB.

Version 1

FROM alpine

RUN dd if=/dev/zero of=output1.data bs=10M count=1
View react-hello-world.js
import React from 'react';
import ReactDOM from 'react-dom';
function App() {
return <div className="App">Hello, world!</div>;
}
ReactDOM.render(
<React.StrictMode>
<App />
View gist:e58bc36b92c037db2c0e600eea14bb3e
03:28 $ docker history ahojukka5/cli-tools:latest
IMAGE CREATED CREATED BY SIZE COMMENT
793390336ae7 2 hours ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
ba5ab62aafdc 2 hours ago /bin/sh -c adduser -D -s /bin/bash -h /wrk j… 4.64kB
c1e51627beaa 2 hours ago /bin/sh -c npm install -g @aws-amplify/cli 545MB
0af384189c12 2 hours ago /bin/sh -c pip install awsebcli 100MB
053a92423510 2 hours ago /bin/sh -c apk add openssl-dev 2.05MB
16b5466140ae 2 hours ago /bin/sh -c apk add libffi libffi-dev 5.49MB
7bfa201ac375 2 hours ago /bin/sh -c gem install travis 11.5MB
88e5bee6bb78 2 hours ago /bin/sh -c apk add make 843kB
View expose_ports.bash
#!/bin/bash
expose() {
REMOTE_HOST=lakka.kapsi.fi
declare -A REMOTE_PORTS
REMOTE_PORTS=(
["jukka.kapsi.fi"]=52400
)
if [[ -z "$1" ]] || [[ -z "$2" ]]
then
@ahojukka5
ahojukka5 / test.py
Created Oct 11, 2020
Testing function with stdin and stdout
View test.py
from io import StringIO
def adding():
x = int(input('Anna luku 1'))
y = int(input('Anna luku 2'))
print("Summa on %d" % (x + y))
def test_adding(monkeypatch, capsys):
View testitiedosto.md

Testiä pukkaa!

def f(x):
  print("Hello world!")
SELECT
  name