Skip to content

Instantly share code, notes, and snippets.

View aleks-mariusz's full-sized avatar

aleks aleks-mariusz

  • London, UK (formerly NYC)
View GitHub Profile
@liwh
liwh / gist:891944
Created March 29, 2011 07:32
the config of screenrc
#
# Example of a user's .screenrc file
#
# http://www.orkut.com/CommMsgs.aspx?cmm=1988&tid=4
# This is how one can set a reattach password:
# password ODSJQf.4IJN7E # "1234"
multiuser on
@threedaymonk
threedaymonk / setup.md
Created June 11, 2011 22:32
IPv6 on home network behind NAT

Gateway machine

Topology

      - _                        NAT         Home network
         )           IPv4         |
        )<----> ISP <----> Router-|       

Public ) |

<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map = null;
function initializeMap() {
$.getJSON("http://www.ombord.info/api/jsonp/position/?callback=?", function(gpsData) {
var currentPosition = new google.maps.LatLng(gpsData.latitude, gpsData.longitude);
map = new google.maps.Map(document.getElementById("map_canvas"), {
@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 5, 2024 04:29
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@pvalkone
pvalkone / gist:9292589
Last active October 19, 2021 06:59
How to set up IPMI Serial-Over-LAN (SOL) on a ASRock C2550D4I motherboard and FreeBSD 10.0-RELEASE
BIOS Setup
----------
1) Boot into the BIOS setup utility (press F2 or DEL) and open Advanced > Serial Port Console Redirection.
2) Disable COM1 and EMS console redirection and enable SOL redirection.
3) Set the SOL console redirection settings as follows:
Aptio Setup Utility - Copyright (C) 2012 American Megatrends, Inc.
Advanced
/----------------------------------------------------+-------------------------\
@rtt
rtt / tinder-api-documentation.md
Last active June 21, 2024 04:19
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

kernel.shmmax = 8000234752 // Это для PostgreSQL, чтоб можно было выставлять большой shared_buffers (6 - 8GB)
fs.file-max = 99999999 // Это для Nginx, без него можно получить "Too many open files"
net.ipv4.tcp_max_syn_backlog=524288 // Максимальное число запоминаемых запросов на соединение
net.ipv4.tcp_max_orphans=262144 // Максимальное число допустимых в системе сокетов TCP
net.core.somaxconn=65535 // Максимальное число открытых сокетов
net.ipv4.tcp_mem=1572864 1835008 2097152 // Потребление памяти для протокола TCP
net.ipv4.tcp_rmem=4096 16384 16777216 // Размер приемного буфера сокетов TCP
net.ipv4.tcp_wmem=4096 32768 16777216 // Количество памяти, резервируемой для буферов передачи сокета TCP
@tuxmartin
tuxmartin / Test.py
Created June 10, 2015 21:54
Python ORM example (Python + SQLAlchemy + SQlite/MySQL)
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy import *
#from sqlalchemy.orm import *
# Pro entity v podadresari. Podaresar *musi* obsahovat prazdny soubor __init__.py !
#from entity.User import User
'''
Zavislosti:
# apt-get install python-sqlalchemy