Skip to content

Instantly share code, notes, and snippets.

Grigoriy Stratov ximik777

Block or report user

Report or block ximik777

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ximik777
ximik777 / pycurses.py
Created Jun 11, 2019 — forked from claymcleod/pycurses.py
Python curses example
View pycurses.py
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@ximik777
ximik777 / print_tree.c
Last active Dec 4, 2017
Printing Binary Trees in Ascii
View print_tree.c
/*
Copy from: http://web.archive.org/web/20090617110918/http://www.openasthra.com/c-tidbits/printing-binary-trees-in-ascii/
Source: http://web.archive.org/web/20071224095835/http://www.openasthra.com:80/wp-content/uploads/2007/12/binary_trees1.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ximik777
ximik777 / aes-ni.c
Created Sep 27, 2017 — forked from acapola/aes-ni.c
AES128 how-to using GCC and Intel AES-NI
View aes-ni.c
#include <stdint.h> //for int8_t
#include <string.h> //for memcmp
#include <wmmintrin.h> //for intrinsics for AES-NI
//compile using gcc and following arguments: -g;-O0;-Wall;-msse2;-msse;-march=native;-maes
//internal stuff
//macros
#define DO_ENC_BLOCK(m,k) \
do{\
@ximik777
ximik777 / AES.c
Created Aug 2, 2017 — forked from bricef/AES.c
A simple example of using AES encryption in Java and C.
View AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@ximik777
ximik777 / README.md
Created Jul 11, 2017 — forked from Jxck/README.md
libuv TCP server/client sample
View README.md

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
@ximik777
ximik777 / custom-error-page
Created May 18, 2017 — forked from simlegate/custom-error-page
Nginx return custom json
View custom-error-page
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@ximik777
ximik777 / array.php
Created May 14, 2017 — forked from serverdensity/array.php
Country dialing code select drop menu
View array.php
<?php
// Country code
$countries = array();
$countries[1] = 'Canada (+1)'; // 1 so array doesn't start at 0 and show empty
$countries[] = 'China (+86)';
$countries[] = 'France (+33)';
$countries[] = 'Germany (+49)';
$countries[] = 'India (+91)';
$countries[] = 'Japan (+81)';
$countries[] = 'Pakistan (+92)';
@ximik777
ximik777 / CountryCodes.json
Created May 14, 2017 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
View CountryCodes.json
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
View compile-nginx.sh
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@ximik777
ximik777 / otrs.conf
Created Dec 9, 2016 — forked from rdoursenaud/otrs.conf
OTRS FCGIWRAP SSL+HSTS NGINX configuration
View otrs.conf
server {
listen 443 ssl;
listen [::]:443 ssl;
keepalive_timeout 70;
server_name otrs.example.com;
root /opt/otrs/var/httpd/htdocs;
index index.html;
# SSL
You can’t perform that action at this time.