Skip to content

Instantly share code, notes, and snippets.

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

Shaig Khaligli mastershaig

🏠
Working from home
  • Planetly
  • Berlin
View GitHub Profile
@wodCZ
wodCZ / Dockerfile
Created February 4, 2018 14:38
django, postgres, redis, celery, nginx, uwsgi docker setup
FROM python:latest
ADD requirements.txt /requirements.txt
RUN python3.6 -m venv /venv \
&& /venv/bin/pip install -U pip \
&& LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "/venv/bin/pip install --no-cache-dir -r /requirements.txt"
ENV PYTHONUNBUFFERED 1
# Copy your application code to the container (make sure you create a .dockerignore file if any large files or directories should be excluded)
RUN mkdir /code/
@Yegorov
Yegorov / ya.py
Created January 13, 2018 16:08
Download file from Yandex.Disk through share link
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://toster.ru/q/72866
# How to
# wget http://gist.github.com/...
# chmod +x ya.py
# ./ya.py download_url path/to/directory
import os, sys, json
@ShahriyarR
ShahriyarR / sort_algo.py
Last active June 12, 2017 15:42
Sort Algorithms implementation in Python3
# This gist is for showing sorting algorithms implementation in Python
unsorted = [91, 6279, 157, 9823, 8585, 2760, 8432, 8427, 7461, 8186, 9528, 1651, 6768, 5913, 8443, 8603, 6856, 6405, 269, 9630, 7744, 3810, 4474, 8856, 1583, 1222, 7331, 1048, 3121,
8411, 5355, 6412, 4039, 4522, 3741, 9726, 9853, 1510, 7038, 330, 5614, 4706, 9815, 9700, 3208, 586, 6563, 2875, 2685, 6364, 5359, 8073, 9329, 8063, 2512, 3775, 9026, 9871,
9862, 1028, 6389, 5597, 25, 9091, 3260, 9377, 7274, 641, 8088, 9837, 2606, 3255, 1896, 1520, 666, 8842, 1939, 4606, 8992, 8292, 9155, 188, 6498, 5047, 2300, 5783, 9103, 3260, 9835, 2670, 1194, 1952, 1273, 7411, 6943, 3632, 5149, 2139, 5521, 6360, 1864, 1509, 9719, 4914, 3471, 9152, 4543, 3157, 9346, 1354, 1015, 6918, 2608, 7906, 9803, 450,
550, 1040, 3815, 1141, 9998, 7920, 3208, 1838, 5582, 8378, 7785, 176, 1433, 8350, 9611, 3919, 3849, 8751, 9484, 3218, 4387, 5544, 2121, 3165, 9618, 483, 4970, 1932, 3289,
8025, 7385, 6975, 637, 7245, 9279, 9232, 3419, 5388, 9097, 5893, 2747, 4329, 1932,

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

anonymous
anonymous / index.html
Created November 9, 2016 17:44
Capture FB Reactions count and show them on webpage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My FB Reactions Page</title>
<style>
html {
box-sizing: border-box;
width: 100%;
@zentetsukenz
zentetsukenz / ruby_on_rails_deployment.md
Last active September 22, 2023 18:32
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@korniychuk
korniychuk / common\config\main-local.php
Created March 30, 2016 15:34
An easy example how to send feedback emails in yii2 (Advanced template)
<?php
return [
'components' => [
...
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
@tokhi
tokhi / buergerbot.rb
Last active November 25, 2023 12:01 — forked from pbock/buergerbot.rb
Bürgerbot: Refreshes the Berlin Bürgeramt page until an appointment becomes available, then notifies you.
#!/usr/bin/env ruby
# make sure you the watir gem installed -> gem install watir
require 'watir'
def log (message) puts " #{message}" end
def success (message) puts "+ #{message}" end
def fail (message) puts "- #{message}" end
def notify (message)
success message.upcase
system 'osascript -e \'Display notification Burgerbot with title "%s"\'' % message
rescue StandardError => e
@magnetikonline
magnetikonline / dumprequest.php
Last active April 30, 2024 08:01
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']