Skip to content

Instantly share code, notes, and snippets.

@anddam
anddam / error
Last active December 4, 2016 19:08
2016/12/04 20:06:22 [crit] 31075#31075: *1 connect() to unix:/home/foo/source/foo.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/home/foo/source/foo.sock:", host: "foo"
def _myhost(args, stdin=None):
if args:
![ssh myhost @(args)]
else:
![ssh myhost -t 'tmux attach']
aliases['myhost'] = _myhost
SSH initialization failed, try again?
com.jcraft.JSchexception: Session.connect: java.io.IOException: End of IO Stream Read
---
com.jcraft.JSchexception: Session.connect: java.io.IOException: End of IO Stream Read
at com.jcraft.jsch.Session.connect(Session.java:485)
at com.jcraft.jsch.Session.connect(Session.java:149)
[follows backtrace]
<?php
return [
/**
* Connection information used by the ORM to connect
* to your application's datastores.
* Do not use periods in database name - it may lead to error.
* See https://github.com/cakephp/cakephp/issues/6471 for details.
* Drivers include Mysql Postgres Sqlite Sqlserver
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
'sqlite' => [
'datasource' => 'Database/Sqlite',
'persistent' => false,
'database' => 'app_db',
'prefix' => '',
'encoding' => 'utf8',
],
charclass = None
while charclass not in classdict:
charclass = input("Select a class in (mage, warrior, rogue): ")
~/Downloads> ipython3 test.py
#-----------------------------------------------------------------------------
# Load Factor Data
#-----------------------------------------------------------------------------
~/Downloads>
def fizzbuzz_v1(number):
"Simpler solution"
if number % 3 == 0:
return "Fizz"
if number % 5 == 0:
return "Buzz"
if number % 15 == 0:
@anddam
anddam / maxmin.py
Last active November 5, 2016 17:58
# CheckIO mission https://py.checkio.org/mission/min-max/
# Write python implementation of the built-in functions max
#
# max(iterable, *[, key])
# max(arg1, arg2, *args[, key])
def min(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
"""Tries to solve https://gist.github.com/jhzab/38640e3df97eb4e25c9f360f87800f54 in a better way
example file at https://gist.github.com/jhzab/d5d4aeeb01ae4094035745a549b4ea14
"""
import json
filename = 'example.json'
result = []
with open(filename) as file:
for line in file: