Skip to content

Instantly share code, notes, and snippets.

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

Alvaro Marquina Sunno

🏠
Working from home
View GitHub Profile
@esmitt
esmitt / APIs.txt
Last active May 20, 2020 08:48
List of interesting free-public APIs, for your projects or for your work! (not really, nobody could use these APIs on its work XD...)
// Chuck Norris Facts
https://api.chucknorris.io/
// Pokemon data
https://pokeapi.co/
// Tracking of the International Space Station
http://open-notify.org/Open-Notify-API/ISS-Location-Now/
@knowsuchagency
knowsuchagency / graphql_example.md
Created February 27, 2018 02:30
graphql example story
# package imports

# why all the try excepts?
# because weird stuff happens
# when this code is executed from a jupyter
# notebook vs as a module vs as __main__
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 18:28
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@miguelwicht
miguelwicht / Terminal commands
Last active November 25, 2016 02:23
Fix JiraLockedError
###remove lock file
```
rm -rf /var/atlassian/application-data/jira.jira-home.lock
```
###stop jira and confluence
```
/opt/atlassian/confluence/bin/stop-confluence.sh
/opt/atlassian/jira/bin/shutdown.sh
```
@McFunkypants
McFunkypants / gist:87f07ac5e8affad34391
Last active March 19, 2024 12:10
Sid Meier's 10 Rules of Game Design
Sid Meier's 10 Rules of Game Design
1. Choose a topic you have a passion for. Game Design is about creativity.
2. Do research after the game is done. Tap into the player’s brain.
3. Define your axioms, refine your axioms. Prototype, prototype, prototype; sit in all the chairs.
4. Double it or cut it in half. You are more wrong than you think.
@amatellanes
amatellanes / celery.sh
Last active April 19, 2024 11:31
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@ibussieres
ibussieres / upgrade_pg.sh
Last active May 26, 2021 04:29
Upgrade PostgreSQL 9.1 to 9.3 on Ubuntu 12.04
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
@BertrandBordage
BertrandBordage / paradox.py
Last active May 6, 2024 13:24
Python Paradox database reader
# coding: utf-8
"""
Converts Paradox databases to Python objects or CSV.
You don't need any dependency (except Python) to make this module work.
This module is incomplete but reads most Paradox `.DB` files.
If this module is not fast or complete enough for you, consider using pxview.
"""