Skip to content

Instantly share code, notes, and snippets.

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
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%'

Briefly describe what your company does and who your customers/clients are.

BeBanjo develops solutions for the Video On Demand industry. Our products help companies like AMC Networks (creators of Mad Men and Breaking Bad) in the U.S. or Sky, Channel 5 or BT Vision in the UK to manage their Video On Demand Services. We pretty much help them with everything they need to do in order to make their content available on multiple platforms and devices; this includes keeping track of their content and acquired rights, putting together a schedule, preparing content metadata, tracking the operational processes and publishing it all to the end platforms.

How many employees do you have, how many work remotely, and where are they located?

We have 14 employees:

  • 6 developers (3 in Madrid, 1 in Asturias, 1 in Berlin, 1 in London)
  • 1 Systems Administrator (Madrid)
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active November 11, 2024 14:18
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@amorgun
amorgun / sample.py
Created November 10, 2017 10:51
SqlAlchemy postgres bulk upsert
from sqlalchemy.dialects import postgresql
def bulk_upsert(session: Session,
items: Sequence[Mapping[str, Any]]):
session.execute(
postgresql.insert(MyModel.__table__)
.values(items)
.on_conflict_do_update(
index_elements=[MyModel.id],
set_={MyModel.my_field.name: 'new_value'},
@sloanlance
sloanlance / jq_jsonl_conversion.md
Last active October 22, 2024 04:35
jq: JSONL ↔︎ JSON conversion

jq: JSONL ↔︎ JSON conversion

Prerequisites

  • jqhttps://jqlang.github.io/jq/ — "like sed for JSON data"

    There are several options available for installing jq. I prefer to use Homebrew: brew install jq

  1. JSONL → JSON

@jhuangtw
jhuangtw / pipenv_jupyter.sh
Last active May 28, 2020 19:19
Running Jupyter with pipenv
pipenv install ipykernel jupyter
pipenv shell
python -m ipykernel install --user --name=$(basename $(pwd))
jupyter notebook
# then in UI, switch kernel to the one matching your pipenv shell name
/*
See https://twitter.com/renschler/status/1081666886377619457 for context,
this gist contains JS snippets you can use one after another to download a csv with your liked tweets.
*/
/* ***************************************************************************** */
/*
Scroll to load liked tweets...
Fist go to your likes page : https://twitter.com/i/likes
@okutbay
okutbay / free_email_provider_domains.txt
Last active August 14, 2024 20:48 — forked from tbrianjones/free_email_provider_domains.txt
Most complete list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created. I also created a service for it https://emailprovider.yonetic.im/ and use this list in my free link shortener service ht…
This file has been truncated, but you can view the full file.
0-00.usa.cc
0-180.com
0-30-24.com
0-420.com
0-900.com
0-aa.com
0-mail.com
0-z.xyz
0.pl
00.pe
@Framartin
Framartin / extensions.py
Last active November 2, 2021 02:32
Simplest scrapy extension to send all errors and exceptions to Sentry
import sentry_sdk
from scrapy.exceptions import NotConfigured
class SentryLogging(object):
"""
Send exceptions and errors to Sentry.
"""
@classmethod
def from_crawler(cls, crawler):