Skip to content

Instantly share code, notes, and snippets.

@afrolovskiy
afrolovskiy / nginx.conf
Created March 1, 2018 11:16 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@afrolovskiy
afrolovskiy / Multiline Curl PUT'ing of data with no extra processing.sh
Created February 22, 2018 15:53 — forked from Integralist/Multiline Curl PUT'ing of data with no extra processing.sh
Multiline Curl PUT'ing of data with no extra processing (thanks to --data-binary flag). We also use @ with a hyphen, so @- (the hyphen indicates input from stdin)
curl -E $DEV_CERT_PEM https://api.our-service.com/component/component-name/configuration --header 'Content-Type: application/json' --request PUT --data-binary @- <<BODY
[
{
"key": "git_ssh_private_key",
"value": "$(cat pri.key)",
"secure": true
},
{
"key": "git_ssh_public_key",
"value": "$(cat pub.key)",
@afrolovskiy
afrolovskiy / Makefile
Created October 4, 2017 09:51 — forked from divan/Makefile
Make help
.PHONY: help
# This is a code for automatic help generator.
# It supports ANSI colors and categories.
# To add new item into help output, simply add comments
# starting with '##'. To add category, use @category.
GREEN := $(shell tput -Txterm setaf 2)
WHITE := $(shell tput -Txterm setaf 7)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)
@afrolovskiy
afrolovskiy / gist:d0270fa4eeec0a36eb0b
Created October 13, 2014 08:30
disable csrf checking
class DisableCSRF(object):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
MIDDLEWARE_CLASSES = ('pdd.settings.local.DisableCSRF',) + base.MIDDLEWARE_CLASSES # noqa
Adobe Flash is proprietary software and hence Fedora does not include it by default
Flash plugin
You have to chose either based on the hardware architecture you are using.
x86_64 (64-bit)
su -c 'yum -y install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm'
x86 (32-bit)
#!/bin/sh
# copied by http://satya164.github.io/fedy/
su -c "curl https://satya164.github.io/fedy/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer"
# -*- coding: utf-8 -*-
import random
import math
import pygame
class Ship(object):
def draw(self):