Skip to content

Instantly share code, notes, and snippets.

View d1ff's full-sized avatar

Vladislav Bortnikov d1ff

  • Russia, Saint Petersburg
View GitHub Profile
\begin{titlepage}
\newpage
\begin{center}
МИНИСТЕРСТВО ОБРАЗОВАНИЯ И НАУКИ \\
РОССИЙСКОЙ ФЕДЕРАЦИИ
\end{center}
\vspace{1em}
\begin{center}
ГОСУДАРСТВЕННОЕ ОБРАЗОВАТЕЛЬНОЕ УЧРЕЖДЕНИЕ \\
@d1ff
d1ff / gist:b772c45048e10d67b92b
Created October 22, 2014 12:14
samsung gt8000 logcat
10-20 23:12:23.122: I/WifiManager(24259): setWifiEnabled : true
10-20 23:12:23.122: I/WifiService(2543): setWifiEnabled: true pid=24259, uid=10257
10-20 23:12:23.122: W/WifiService(2543): Failed getting userId using ActivityManagerNative
10-20 23:12:23.122: W/WifiService(2543): java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=24259, uid=10257 requires android.permission.INTERACT_ACROSS_USERS
10-20 23:12:23.122: W/WifiService(2543): at com.android.server.am.ActivityManagerService.getCurrentUser(ActivityManagerService.java:20238)
10-20 23:12:23.122: W/WifiService(2543): at com.android.server.wifi.WifiService.setWifiEnabled(WifiService.java:2254)
10-20 23:12:23.122: W/WifiService(2543): at com.android.server.wifi.WifiService.setWifiEnabled(WifiService.java:2242)
10-20 23:12:23.122: W/WifiService(2543): at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:178)
10-20 23:12:23.122: W/WifiService(2543): at android.os.Binder.execTransact(Binder.java:404)
10-20 23:12:23.122:
@d1ff
d1ff / gist:2d3b3119b36676fbc855
Created November 18, 2014 19:26
boost type erasure
#include <boost/type_erasure/any.hpp>
#include <boost/type_erasure/member.hpp>
#include <boost/mpl/vector.hpp>
BOOST_TYPE_ERASURE_MEMBER((has_init), init, 0)
BOOST_TYPE_ERASURE_MEMBER((has_loadIntoTexture), loadIntoTexture, 1)
using _self = boost::type_erasure::_self;
@d1ff
d1ff / gist:88eb11b429e730614dbb
Created June 7, 2015 15:05
mongo aggregation query
[
{
$match:
{
"last_request.2015_05_20": {$exists: true}
}
},
{
$project: {
"main_computer": 1,
#!/bin/bash
source /etc/container_environment.sh
echo $DJANGO_HOST >> /app-data/test.txt
enum severity_level
{
debug = 7,
info = 6,
warning = 4,
error = 3,
critical = 2
};
@d1ff
d1ff / call_all.cpp
Created February 22, 2016 14:43
call_all
template <class T, class P, typename... Params1, typename... Params2>
static void call_all(QList<QPointer<T>> &objs, void (P::*func)(Params1...), Params2&&... parameters) {
//qDebug() << "call_all" << objs.size();
for (QPointer<T> &obj: objs) {
if (obj.isNull()) continue;
(obj->*func)(std::forward<Params2>(parameters)...);
}
}
$> scrapy startproject airspider
Traceback (most recent call last):
File "/Users/d1ff/.brew/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/Users/d1ff/.brew/lib/python3.5/site-packages/scrapy/cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "/Users/d1ff/.brew/lib/python3.5/site-packages/scrapy/cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/Users/d1ff/.brew/lib/python3.5/site-packages/scrapy/cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
x_val = [1 2 3 4 5 6 7 8 9 10];
n = length(x_val);
x_ = linspace(0, 11, 100);
F_val = zeros(1, length(x));
for j = 1:length(x_)
if x_(j) <= x(1)
F_val(j) = 0;
continue;
end
if x_(j) > x_val(n)
@d1ff
d1ff / airline.zsh
Created May 21, 2016 10:45
Gist with my zsh theme
#
# This shell prompt config file was created by promptline.vim
#
function __promptline_host {
local only_if_ssh="0"
if [ ! $only_if_ssh -o -n "${SSH_CLIENT}" ]; then
if [[ -n ${ZSH_VERSION-} ]]; then print %m; elif [[ -n ${FISH_VERSION-} ]]; then hostname -s; else printf "%s" \\h; fi
fi
}