Skip to content

Instantly share code, notes, and snippets.

View andriisoldatenko's full-sized avatar
🏠
Working from home

Andrii Soldatenko andriisoldatenko

🏠
Working from home
View GitHub Profile
@andriisoldatenko
andriisoldatenko / constdereference.patch
Created July 12, 2012 18:55 — forked from laruence/constdereference.patch
Const array/string dereference
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index d0730b7..893e013 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -789,8 +789,8 @@ expr_without_variable:
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
| scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '[' array_pair_list ']' { $$ = $2; }
@andriisoldatenko
andriisoldatenko / gist:703627dabba135197d9d
Last active August 29, 2015 14:12
Fabric example for deplot Django
from fabric.api import env, run, local, task
from fabric.colors import green
env.hosts = ['1.1.1.1']
env.port = '8888'
env.user = 'root'
env.key_filename = '~/.ssh/id_rsa'
<div id="facebook_login_js">
<input onclick="F.connect(this.parentNode.parentNode); return false;" type="image" src="{{ STATIC_URL }}django_facebook/images/facebook_login.png" /><br />
(javascript popup)
</div>
@andriisoldatenko
andriisoldatenko / parallelism_in_one_line.py
Last active June 5, 2017 12:42
Parallelism in one line
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
urls = [
'http://www.python.org',
'http://www.python.org/about/',
'http://www.onlamp.com/pub/a/python/2003/04/17/metaclasses.html',
'http://www.python.org/doc/',
'http://www.python.org/download/',
'http://www.python.org/getit/',
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.bundle import Bundle
from tastypie.exceptions import NotFound
from tastypie.resources import Resource
# a dummy class representing a row of data
class Row(object):
@andriisoldatenko
andriisoldatenko / install_local_python.sh
Created August 6, 2015 09:45
Install local python on CentOS
#set -x
TMP_PATH=~/tmp_install_python
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
SETUPTOOLS_VERSION=18.1
mkdir $TMP_PATH
cd $TMP_PATH
{
"auto_complete": false,
"color_scheme": "Packages/Solarized Color Scheme/Solarized (dark).tmTheme",
//"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"default_encoding": "UTF-8",
"file_exclude_patterns":
[
".DS_Store",
"*.pid",
@andriisoldatenko
andriisoldatenko / install_python.sh
Last active May 14, 2020 05:43
Install local Python 2.7.10 on CentOS 7
TMP_PATH=~/tmp_install_python
# Versions section
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
mkdir $TMP_PATH && cd $TMP_PATH
# Update yum and libraries
yum -y update
@andriisoldatenko
andriisoldatenko / mul.py
Created August 31, 2015 12:25
matrix_multiply
A = [[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]
B = [[1, 2, 3, 4],
[1, 2, 3, 4],
[1, 2, 3, 4]]
@andriisoldatenko
andriisoldatenko / create_user_centos_7.sh
Created September 3, 2015 10:07
Create new user centos 7.1 and add to sudoers
# based on this
# https://wiki.centos.org/HowTos/Network/SecuringSSH
# https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-a-centos-7-server
# Create user
sudo adduser newuser
sudo /usr/sbin/visudo