Skip to content

Instantly share code, notes, and snippets.

View Saren-Arterius's full-sized avatar
💭
(^^)

Saren Arterius Saren-Arterius

💭
(^^)
View GitHub Profile
alias sta='sudo systemctl start'
alias sto='sudo systemctl stop'
alias stt='sudo systemctl status'
alias rst='sudo systemctl restart'
alias enb='sudo systemctl enable'
alias dsb='sudo systemctl disable'
alias s='sudo apt install'
alias i='sudo apt install'
alias r='sudo apt remove'
@Saren-Arterius
Saren-Arterius / FourInALine.java
Created November 13, 2016 09:21
ITP3914 Four-in-a-Line
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class FourInALine {
public static final Scanner scanner = new Scanner(System.in);
public static final int WIN_MIN_LENGTH = 4;
public static final int ROW_COUNT = 6;
public static final int COLUMN_COUNT = 7;
#!/usr/bin/env python2
# Problem: http://9gag.com/gag/a6Qq368?ref=fb.s
# sudo pip2 install python-constraint
from constraint import *
variables = "a", "b", "c"
problem = Problem()
for v in variables:
problem.addVariable(v, range(10))
problem.addConstraint(AllDifferentConstraint())
problem.addConstraint(FunctionConstraint(lambda a, b, c: (a == 5) + (b == 4) + (c == 8) == 1), variables)
powershell %UserProfile%\Desktop\msi.ps1 on
<#
.SYNOPSIS
MSI-mode utility
.DESCRIPTION
Main purpose of this script is turning on MSI-mode for all PCI devices in bulk. Script offers four modes which can be selected through following command line arguments:
'on' - turning MSI-mode on;
'off' - turning MSI-mode off;
'reg' - printing reg-file for backup purposes (to save text to reg-file use standard redirection or piplining to comandlet Out-File);
- started without command line argument script prints devices capable for MSI-mode.
@Saren-Arterius
Saren-Arterius / ubm-solver.py
Last active July 1, 2019 14:29
Unblock Me solver
#!/usr/bin/env python3
# An Unblock Me solver written using A* search algorithm
# perfect solution
# Author: Saren
SIZE = 6
"""
GOAL = (
(' ', ' ', ' ', ' ', ' ', ' '),
(' ', ' ', ' ', ' ', ' ', ' '),
(' ', ' ', ' ', ' ', 'T', 'G'),
@Saren-Arterius
Saren-Arterius / gist:b26fa2ff529f3f339b31d84f09375d5b
Last active April 16, 2016 13:59
Code Jam 2016 Round 1A Q3 BFFs (10% Incorrect solution)
#!/usr/bin/env python3
"""
Failed in this case, does not know why.
1
6
2 3 2 5 4 3
"""
FORMAT = "Case #{}: {}"
#!/bin/bash
# This script should be run by a Minecraft server
# Notice: You will NOT be able to connect ddos.protected-server.domain from the same
# public IP address as vulnerable-minecraft-server.domain has. I have wasted at least
# 8 hours then found out that.
REMOTE_DOMAIN="ddos.protected-server.domain"
PROTECTOR_PORT=8080
#!/bin/bash
# This script should be run by a DDoS protected server
REMOTE_DOMAIN="vulnerable-minecraft-server.domain"
PROTECTOR_PORT=8080
PROTECTED_PORT=25565
echo Fetching IPs...
PROTECTOR_IP=$(ip a | grep inet | awk 'FNR == 3 {print $2}' | sed 's/\/[0-9]\{1,\}//g')
@Saren-Arterius
Saren-Arterius / komica.py
Last active January 3, 2016 06:21
聲優廚終結者
#!/usr/bin/env python3
from pybrain.datasets import SupervisedDataSet
from pybrain.structure import TanhLayer
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.tools.shortcuts import buildNetwork
from pyquery import PyQuery as pq
from os.path import exists
import urllib.request
import pickle