Skip to content

Instantly share code, notes, and snippets.

@x10an14
x10an14 / filosofi.py
Created January 25, 2022 12:40
Forskjell på filosofi
liste_tall = [1, 2, 3, 4, 5, 6]
def summere_imperativt(liste):
sum = 0
for tall in liste:
sum += sum
return sum
def summere_deklarativt(liste):
sum = reduce(x + y, liste)
#!/usr/bin/env bash
USER_NAME_TO_RUN_STEAM="x10an14"
IP_SUBNET="10.10.10"
LOCAL_DNS="<X.Y.Z.W>"
echo 'Setting up steam network namespace...'
sudo ip netns add steam_ns
sudo ip netns exec steam_ns ip addr add 127.0.0.1/8 dev lo
sudo ip netns exec steam_ns ip link set lo up
#!/usr/bin/env python3.6
from contextlib import suppress
from pathlib import Path, PosixPath
from subprocess import run, PIPE
from sys import exit, argv
from sys import stderr, executable
if __name__ == '__main__':
[2018.03.16T22:02:22CET] x10an14@x10-P65xRP ~/overtime-calculator (minor_changes *% u= origin/minor_changes) $ pipenv run python -m coverage run -m py.test -v
==================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.6.3, pytest-3.4.2, py-1.5.2, pluggy-0.6.0 -- /home/x10an14/.local/share/virtualenvs/overtime-calculator-Z0nwGDbO/bin/python
cachedir: .pytest_cache
rootdir: /home/x10an14/Documents/github/overtime-calculator, inifile: setup.cfg
plugins: hypothesis-3.49.1
collected 7 items
overtime_calculator/tests/auth_test.py::test_register FAILED
@x10an14
x10an14 / Installation of Ubuntu 16.04 LTS VM on Windows 10 HyperV.md
Created March 16, 2018 15:21
Installation of Ubuntu 16.04 LTS VM on Windows 10 HyperV

Installation of Ubuntu 16.04 LTS VM on Windows 10 HyperV

Installation steps executed:

  1. Selected "Generation 2" VM during installation wizard
    • So as to choose UEFI as default boot mode.
  2. Turned off SecureBoot
    1. By following these instructions in an admnin-escalated powershell terminal.
  3. Added video=hyperv_fb:1920x1200 to GRUB_CMDLINE_LINUX_DEFAULT to use the full available resolution of the laptop monitor (in fullscreen).
  4. Replaced english keyboard with norwegian inside of the VM 'try ubuntu live' session.
@x10an14
x10an14 / docker-compose.yaml
Last active March 12, 2018 16:34
docker-compose.yaml, normal output, and verbose output. Unable to start server through `docker-compose up`
# Docker compose file syntax:
version: '2'
services:
drone-server:
image: drone/drone:0.8
ports:
- 5124:8000
- 5125:9000
@x10an14
x10an14 / output.sh
Last active May 1, 2019 01:20
Unable to find toml_test3.py
x10an14@x10Desktop2016:~/Documents/git_projs/toml$ sudo apt-get install golang
[sudo] password for x10an14:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-72 linux-headers-4.4.0-72-generic linux-image-4.4.0-72-generic
linux-image-extra-4.4.0-72-generic linux-signed-image-4.4.0-72-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
@x10an14
x10an14 / webappp.py
Last active December 4, 2016 21:46
Why u no such html content when accessing this endpoint? =(
x10an14@x10Desktop2016:~/Documents/git_projs/overtime_calculator$ venv/bin/python webapp.py
2016-12-04 22:44:47,201: DEBUG:
▄▄▄▄▄
▀▀▀██████▄▄▄ _______________
▄▄▄▄▄ █████████▄ / \
▀▀▀▀█████▌ ▀▐▄ ▀▐█ | Gotta go fast! |
▀▀█████▄▄ ▀██████▄██ | _________________/
▀▄▄▄▄▄ ▀▀█▄▀█════█▀ |/
▀▀▀▄ ▀▀███ ▀ ▄▄
▄███▀▀██▄████████▄ ▄▀▀▀▀▀▀█▌
@x10an14
x10an14 / gist:a214406122949bf060c84b80fc386829
Created October 16, 2016 14:53
Coconut mypy test failing
x10an14@x10Desktop2016:~/Documents/git_projs/coconut$ docker run -it --entrypoint sh coconut_ipython:3.4-alpine
/usr/coconut # make test
pytest --strict -s tests
============================================================================================ test session starts =============================================================================================
platform linux -- Python 3.4.5, pytest-3.0.2, py-1.4.31, pluggy-0.3.1
rootdir: /usr/coconut, inifile:
collected 20 items
tests/main_test.py
> coconut -s -c msg = '<success>'; pmsg = print$(msg); `pmsg`
@x10an14
x10an14 / Attempt_nr2.txt
Last active September 30, 2016 07:04
Coconut test segfault in minimized alpine docker container image
$ docker run -it --entrypoint bash test
bash-4.3# coconut tests/src/extras.coco tests/dest --run
Coconut: Compiling tests/src/extras.coco ...
Coconut: Compiled to tests/dest/extras.py .
CoconutWarning: missing new line at end of file (line 1)
abc
^
CoconutWarning: missing new line at end of file (line 1)
abc
^