This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// works with FuelPHP 1.4 | |
return array( | |
'default' => array( | |
'type' => 'pdo', | |
'connection' => array( | |
'dsn' => 'sqlite:/PATH/TO/DATABASE_FILE', | |
'username' => '', | |
'password' => '', | |
), | |
'charset' => NULL, /* http://stackoverflow.com/questions/263056/how-to-change-character-encoding-of-a-pdo-sqlite-connection-in-php */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install Scala on Mac : Install Java VM, Install Homebrew, | |
// In terminal type: brew install scala | |
// Scala is the perfect choice if you want to explore functional | |
// programming without disregarding OOP | |
// Scala runs on the JVM which provides a ton of libraries | |
// File ends with the scala extension | |
// How to import library functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
listen 443 ssl http2 default_server; | |
listen [::]:443 ssl http2 default_server; | |
ssl on; | |
ssl_certificate your-bundle.cert; | |
ssl_certificate_key your-key.key; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses, random | |
screen = curses.initscr() | |
width = screen.getmaxyx()[1] | |
height = screen.getmaxyx()[0] | |
size = width*height | |
char = [" ", ".", ":", "^", "*", "x", "s", "S", "#", "$"] | |
b = [] | |
curses.curs_set(0) | |
curses.start_color() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# take the names from argv | |
first_name = sys.argv[1] | |
second_name = sys.argv[2] | |
sentence = '{} loves {}'.format(first_name, second_name) | |
# first remove the space and lower the sentence | |
sentence = sentence.replace(' ', '').lower() | |
# variable to store numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "9G Rail Ltd", | |
"iata": "9G" | |
}, | |
{ | |
"name": "Buryat Airlines", | |
"iata": "БЮ" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description= instance to serve jobs api | |
After=network.target | |
[Service] | |
User=root | |
Group=www-data | |
ExecStart=/home/path/to/binary/you/uploaded(which in my case is/var/www/go/jobs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = {1:11, 2:22, 3:33} | |
# filter by key | |
d2 = {k: v for k, v in filter(lambda t: t[0] in [1, 3], d.items())} | |
# filter by value | |
d3 = {k: v for k, v in d.items() if v in [2,3]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=gunicorn daemon | |
After=network.target | |
[Service] | |
User=sammy | |
Group=www-data | |
WorkingDirectory=/home/sammy/myproject | |
ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/sammy/myproject/myproject.sock myproject.wsgi:application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Puma Rails Server | |
After=network.target | |
[Service] | |
Type=simple | |
User=deploy | |
WorkingDirectory=/home/deploy/app/current | |
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb | |
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop |