Skip to content

Instantly share code, notes, and snippets.

View natanfeitosa's full-sized avatar

Natanael dos Santos Feitosa natanfeitosa

View GitHub Profile
@alexandervantrijffel
alexandervantrijffel / pre-commit-for-go-projects
Last active March 18, 2024 05:10
git pre-commit hook script that runs go build, go test, goimports for all packages
#!/bin/bash
# How to use:
# Store this file as .git/hooks/pre-commit and make it executable
# Or, to share the hook with your team, store as .githooks/pre-commit,
# make this file executable and run:
# git config core.hooksPath .githooks
# A pre-commit hook for go projects. In addition to the standard
@arsho
arsho / update_pypi_package.md
Last active March 26, 2025 00:06
Update existing Python package in Pypi

Update PyPI package (Tested on 12/31/2023)

I updated my package autolike today using the following steps:

Update the project locally

  • Changed the version number in setup.py and modify package as necessary.

Test in development

Assuming you’re in the root of your project directory, then run:

pip install -e .

Created a build

@mdonkers
mdonkers / server.py
Last active October 23, 2025 16:32
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@AgentOak
AgentOak / youtube_formats.md
Last active October 25, 2025 11:26
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
@fossbalaji
fossbalaji / duration.py
Last active September 19, 2021 16:27
How to get video file duration and resolution in python
from subprocess import Popen, PIPE
import re
def getvideodetails(filepath):
cmd = "avconv -i %s" % filepath
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
di = p.communicate()
for line in di:
if line.rfind("Duration") > 0:
duration = re.findall("Duration: (\d+:\d+:[\d.]+)", line)[0]
@brennanMKE
brennanMKE / hero.ts
Last active April 6, 2025 07:33
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@kived
kived / sharetest.py
Created January 28, 2015 22:54
Kivy: start share intent chooser
from kivy.app import App
from kivy.lang import Builder
from jnius import autoclass
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Intent = autoclass('android.content.Intent')
String = autoclass('java.lang.String')
root = Builder.load_string('''
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@kergoth
kergoth / README.rst
Created May 10, 2011 00:38
Experiments with splitting the lexer out of the parser for BitBake's file format

TODO

  • Verify that IndentTokenizer works with a non-LINE-based tokenizer specification, rather than the default
  • Resurrect the 'NEWLINE' token, as we need it to be as picky about the file format as the current parser is
  • Implement a parser which leverages this to properly change the lexer states for both ordinary functions and "def" syntax functions. Determine if this should be custom or PLY or codetalker or what, by first determining whether these libraries would support a lexer like ours
  • Do performance testing comparing the new parser against the old, and against the pyparsing implementation