Skip to content

Instantly share code, notes, and snippets.

View vtr0n's full-sized avatar
🦊

Valery Krasnoselsky vtr0n

🦊
View GitHub Profile
@vtr0n
vtr0n / create_credential.sh
Created May 14, 2019 12:20
nginx http auth with cookies
# create the password file for user 'admin'
sudo htpasswd -c /etc/nginx/.htpasswd admin
@vtr0n
vtr0n / increase_open_files_limit.txt
Last active March 11, 2019 07:48
Increase open files limit in Ubuntu 16.04
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
96872
# current available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@vtr0n
vtr0n / bench.php
Last active July 13, 2018 08:22
PHP benchmark static function, object function, function
<?php
class SomeStaticClass
{
public static function doTest($i) {
sqrt($i);
}
}
class SomeClass
@vtr0n
vtr0n / npyscreen_exapmle_4.py
Last active April 21, 2018 08:07
Npyscreen example 4
#!/usr/bin/env python3
from src import npyscreen
import curses
class App(npyscreen.StandardApp):
def onStart(self):
self.addForm("MAIN", MainForm, name="Hello Medium!")
class InputBox1(npyscreen.BoxTitle):
_contained_widget = npyscreen.MultiLineEdit
@vtr0n
vtr0n / npyscreen_exapmle_3.py
Last active November 24, 2020 21:24
Npyscreen example 3
#!/usr/bin/env python3
from src import npyscreen
import random
class App(npyscreen.StandardApp):
def onStart(self):
# Set the theme. DefaultTheme is used by default
npyscreen.setTheme(npyscreen.Themes.ColorfulTheme)
self.addForm("MAIN", MainForm, name="Hello Medium!")
@vtr0n
vtr0n / npyscreen_exapmle_2.py
Created April 21, 2018 07:40
Npyscreen example 2
#!/usr/bin/env python3
import npyscreen
class App(npyscreen.StandardApp):
def onStart(self):
self.addForm("MAIN", MainForm, name="Hello Medium!")
class MainForm(npyscreen.FormBaseNew):
def create(self):
# Get the space used by the form
@vtr0n
vtr0n / npyscreen_exapmle_1.py
Last active April 21, 2018 07:39
Npyscreen example 1
#!/usr/bin/env python3
import npyscreen
class App(npyscreen.StandardApp):
def onStart(self):
self.addForm("MAIN", MainForm, name="Hello Medium!")
class MainForm(npyscreen.ActionForm):
# Constructor
def create(self):
@vtr0n
vtr0n / MySQL.php
Created March 4, 2018 18:50
MySQL Class Simple
<?php
class MySQL
{
var $link;
function __construct()
{
include_once dirname(__FILE__) . '/config.php';
$this->link = mysqli_connect(
config\MYSQL_HOST,
@vtr0n
vtr0n / hack.js
Created February 28, 2018 09:58
Gravity Ninja 2 Hack, Telegram
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>
// your next score
need_score = 999999;
// part of game url, you can find this in network monitor on your browser. Find POST with "set-web-score*", when game is over
var game_url = '*GAME URL*';