Skip to content

Instantly share code, notes, and snippets.

View mikroskeem's full-sized avatar
👻

Mark Vainomaa mikroskeem

👻
View GitHub Profile
(function(b){b.image=function(c,a){a=a||1;var d=new Image;d.onload=function(){b.log("%c+","font-size:1px;padding:"+Math.floor(this.height*a/2)+"px "+Math.floor(this.width*a/2)+"px;line-height:"+this.height+"px;background:url("+c+");background-size:"+this.width*a+"px "+this.height*a+"px;color:transparent;")};d.src=c}})(console);
@mikroskeem
mikroskeem / scroll.html
Created June 27, 2015 07:33
scroll to top in pure js, css and html5
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<style>
#stw{text-align:center}#stw{position:fixed;opacity:0;visibility:hidden;overflow:hidden;z-index:99999999;background-color:#777;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;border-radius:10px}#stw:hover{background-color:#888}#stw.show{visibility:visible;cursor:pointer;opacity:1}#stw i.fa{line-height:inherit}
</style>
<script>
window.addEventListener("load", function(){
scrollTo = function(element, to, duration) {
if (duration < 0) return;
var difference = to - element.scrollTop,
perTick = difference / duration * 10;
@mikroskeem
mikroskeem / Arch Linux btrfs install.md
Last active October 18, 2024 19:52 — forked from artizirk/Arch Linux btrfs install.md
Arch Linux installation on btrfs subvolumes

Arch Linux btrfs install

NOTE: Last update to this gist was on Jun 2, 2018. Most of the things here are out of date (e.g consider using zstd for transparent compression instead of lzo), so do your own research as well. Take care!

0. Prerequisites

  • Plenty of storage - snapshots will take (sort of) a lot of space
  • Latest Arch Linux install iso because those have newer kernels and more bugfixes in btrfs.
  • Have previous experience with installing Arch (like you can install arch with a blind fold).
  • Read everything through
var dbus = require('dbus-native');
exports.dbusConnection = dbus.systemBus();
var machineService = exports.dbusConnection.getService('org.freedesktop.machine1');
exports.getMachines = function(){
return new Promise(function(resolve,reject){
machineService.getInterface(
'/org/freedesktop/machine1',
import flask
from pymemcache.client.base import Client
client = Client(('localhost', 11211))
def memcache(real_cont):
def _cache():
content = client.get("test-/")
if not content:
@mikroskeem
mikroskeem / ovpn-writer.sh
Last active July 10, 2016 17:19 — forked from renatolfc/ovpn-writer.sh
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Note: this generates profile which works with Android OpenVPN Connect
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
#!/usr/bin/env python3
"""
Calculate real task delay when server TPS (ticks per second)
is lower than 20
"""
import math
import sys
def calculate(task_length:float, server_speed:float):
"""
@mikroskeem
mikroskeem / pom-snippet.xml
Created September 24, 2016 11:46
Obfuscate with yGuard in Maven
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
@mikroskeem
mikroskeem / draw.html
Created September 30, 2016 13:01
Extremely old canvas test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JS test</title>
<style type="text/css">
* { margin:0; padding:0; }
html, body { width:100%; height:100%; }
canvas { background: #eee; }
@mikroskeem
mikroskeem / Main.java
Last active March 7, 2019 19:55
Example wrapper code to work around server hoster shitty flags and use your own
import java.io.FileOutputStream;
import java.io.Reader;
import java.io.Writer;
import java.lang.management.ManagementFactory;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.file.Files;
import java.nio.file.Path;