Skip to content

Instantly share code, notes, and snippets.

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

Aidis Stukas aidiss

🏠
Working from home
View GitHub Profile
@conradlee
conradlee / clique_percolation_indexed.py
Created November 5, 2011 19:56
Clique percolation in Python using NetworkX (with indexing)
import networkx as nx
from collections import defaultdict
def get_percolated_cliques(G, k):
perc_graph = nx.Graph()
cliques = [frozenset(c) for c in nx.find_cliques(G) if len(c) >= k]
perc_graph.add_nodes_from(cliques)
# First index which nodes are in which cliques
membership_dict = defaultdict(list)
@revelt
revelt / Lithuanian stop words
Created May 16, 2016 22:53
Here are deduped, checked and sorted stop words for Lithuanian language. Use them in all search/indexing applications, for example Lunr.js
a
abi
abidvi
abiejose
abiejų
abiejuose
abiem
abipus
abu
abudu
@mahmoudimus
mahmoudimus / fabfile.py
Created April 30, 2010 07:43 — forked from cyberdelia/fabfile.py
fabric deployment example
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@eristoddle
eristoddle / g_suggest.py
Created September 19, 2012 17:36
Python Google Suggest Scraper
from urllib import quote
from string import ascii_lowercase
from operator import itemgetter
import os
import random
import requests
from datetime import datetime
from lib.languages import LANGUAGES, get_language_by_name
from lib.utils import format_timedelta
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# "Colorizing B/W Movies with Neural Nets",
# Network/Code Created by Ryan Dahl, hacked by samim.io to work with movies
# BACKGROUND: http://tinyclouds.org/colorize/
# DEMO: https://www.youtube.com/watch?v=_MJU8VK2PI4
# USAGE:
# 1. Download TensorFlow model from: http://tinyclouds.org/colorize/
# 2. Use FFMPEG or such to extract frames from video.
# 3. Make sure your images are 224x224 pixels dimension. You can use imagemagicks "mogrify", here some useful commands:
# mogrify -resize 224x224 *.jpg
# mogrify -gravity center -background black -extent 224x224 *.jpg
@perrygeo
perrygeo / TODO
Last active December 31, 2022 21:24
Ansible playbook for a full dev environment
TODO
implement security measures
git config
config files
full sublimetext config
set up openvpn
rdesktop and network drive to terra
set up evolution
RStudio
@devStepsize
devStepsize / slack_webhook_post.py
Last active August 7, 2023 09:28
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
@christophermanning
christophermanning / README.mkd
Last active August 28, 2023 00:46
Hamiltonian Graph Builder
<style type="text/css">p {text-align:center;width: auto}</style>

Created by Christopher Manning

Gallery

Axle Eight Fibbobaci Florets [![Star]

@miguelgrinberg
miguelgrinberg / rest-server.py
Last active March 29, 2024 09:05
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':