Skip to content

Instantly share code, notes, and snippets.

@aoleg94
aoleg94 / nxmp-http-server.py
Last active June 21, 2022 14:42
nxmp-http-server.py
#!/usr/bin/env python3
from http.server import *
from http import HTTPStatus
import os, sys, io, socket, urllib.parse, html
class ApacheLikeHTTPRequestHandler(SimpleHTTPRequestHandler):
def list_directory(self, path):
"""Helper to produce a directory listing (absent index.html).
@aoleg94
aoleg94 / .gitignore
Last active July 18, 2019 07:38
gcc linker list
linker_list
*.o
#include <windows.h>
#include <spawn.h>
#include <sys/wait.h>
int main(int argc, char** argv, char** envp)
{
if(argc < 2)
{
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
return 0;
@aoleg94
aoleg94 / ntp.lua
Created April 16, 2019 10:11
ntpq in lua
--local socket = require'socket'
-- http://lua-users.org/wiki/SplitJoin
-- explode(separator, string)
local function explode(d,p)
local t, ll
t={}
ll=0
if(#p == 1) then
return {p}
@aoleg94
aoleg94 / gitlab-cp1251.patch
Created December 26, 2018 08:26
Gitlab CP1251 patch
cd /opt/gitlab && patch -p2 < this-patch
--- opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/gitlab-grit-2.8.2/lib/grit_ext.rb.orig 2018-12-22 01:24:08.000000000 +0500
+++ opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/gitlab-grit-2.8.2/lib/grit_ext.rb 2018-12-26 13:21:46.792000000 +0500
@@ -22,7 +22,8 @@
# encoding message to detect encoding
if detect && detect[:encoding]
- message.force_encoding(detect[:encoding])
+ message.force_encoding("windows-1251")
+ message.encode("utf-8", "windows-1251", undef: :replace, replace: "", invalid: :replace)
pkgname=libva1-ubuntu
pkgver=1.7
pkgrel=1
pkgdesc="Old libva from Ubuntu 16.04 for apps not supporting libva2 (esp. Parsec.tv)"
arch=('x86_64')
url="https://linux.palemoon.org"
license=('GPL' 'BSD')
depends=()
mirror="http://archive.ubuntu.com/ubuntu"
source=(
@aoleg94
aoleg94 / ydwatch.sh
Created May 23, 2017 13:13
Yandex.Disk i3blocks widget
#!/bin/bash
if [ -n "$BLOCK_BUTTON" ]; then
case $BLOCK_BUTTON in
1) yandex-disk start ;;
2) yandex-disk stop ;;
esac
fi 2>&1 >/dev/null
T=`LC_ALL=C yandex-disk status | head -n2`
From 436f5d97ba3c0ebdfbd233f31751ca2ad5b6feba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?=
=?UTF-8?q?=D0=BE=D0=B2=20=D0=9E=D0=BB=D0=B5=D0=B3?=
<aoleg94@gmail.com>
Date: Tue, 12 Jul 2016 11:34:12 +0500
Subject: [PATCH] execve patch series
---
linux-user/main.c | 36 +++++++++++
linux-user/qemu.h | 1 +
$ python vkfast.py
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> res = vk.messages.getDialogs()
>>> print res.response[1].body
<last chat's last message>
@aoleg94
aoleg94 / trafficcount.py
Last active January 9, 2016 20:34
Traffic counter for i3blocks
#!/usr/bin/env python
import os, sys
FILE=os.path.join(os.environ.get('HOME', ""), '.cache/trafficcount')
DEVICE=os.environ.get('BLOCK_INSTANCE','wlp13s0')
FILE2=os.path.join(os.environ.get('HOME', ""), '.cache/trafficcount_limit')
def parseSize(s):
TABLE={ 'K':2**10,
'M':2**20,
'G':2**30,