Skip to content

Instantly share code, notes, and snippets.

View ngetahun's full-sized avatar

Natnael Getahun ngetahun

View GitHub Profile
@pamelafox
pamelafox / selenium_dom.py
Created January 17, 2012 02:36
Python Selenium Dom Helper Functions
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
@matrixise
matrixise / validator.py
Created September 2, 2013 21:09
Explain the validators of SQLAlchemy.
#!/usr/bin/env python
import datetime
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.schema import CheckConstraint
from sqlalchemy.orm import validates
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import IntegrityError
@petems
petems / Gemfile
Last active November 18, 2021 11:05
An example http download with Progress Bar output in the command line with Ruby and the native `net/http` library...
source "https://rubygems.org"
gem "progressbar"
@st0012
st0012 / Gemfile
Created March 11, 2016 03:50 — forked from grantspeelman/Gemfile
Example Gemfile files preparing for the next rails upgrade
@next_upgrade ||= false
source 'https://rubygems.org'
if @next_upgrade
gem 'rails', '5.0.0.beta3'
gem 'rails-controller-testing' # https://github.com/rails/rails-controller-testing
else
gem 'rails', '~> 4.2.5.1'
end
require 'warden/github'
class SidekiqGithubChecker
def self.registered(app)
app.helpers do
def warden; env['warden'] end
def github_organization_authenticate!(name)
unless warden.user.organization_member?(name)
halt [401, {}, ["You don't have access to organization #{name}"]]
end
@raulgarreta
raulgarreta / get_followers_bios.py
Created October 3, 2016 06:44
Simple Python command to get Twitter user followers with the public API.
# -*- coding: utf-8 -*-
import csv
import time
import re
import codecs, cStringIO
from argparse import ArgumentParser
import tweepy
@rmosolgo
rmosolgo / Gemfile
Last active March 27, 2023 08:38
GraphQL Ruby Subscriptions
source 'https://rubygems.org'
gem "graphql", github: "rmosolgo/graphql-ruby", branch: "subscriptions"
gem "sinatra"
gem "thin"
@anvk
anvk / psql_useful_stat_queries.sql
Last active June 28, 2024 08:55
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@asottile
asottile / queueing.py
Created July 15, 2020 21:40
really bad queue simulating sqs backed by sqlite
import contextlib
import fcntl
import json
import sqlite3
import time
import uuid
from typing import Any
from typing import Generator
from typing import Optional
from typing import Tuple