Skip to content

Instantly share code, notes, and snippets.

View pombredanne's full-sized avatar

Philippe Ombredanne pombredanne

View GitHub Profile
@pombredanne
pombredanne / swiftpack-api.md
Created August 28, 2021 07:58
Swiftpack.co API

Authorization

You need to provide Authorization header in form Basic yourtoken and User-Agent header

Endpoints

  • /api/fresh
  • /api/popular
  • /api/search

All endpoints accept offset and limit (max 1000) query params. Search endpoint also requires query endpoint.

@pombredanne
pombredanne / api.py
Created April 17, 2021 22:56 — forked from AmitGupta7580/api.py
bulk_search API Code suggestion for vulnerablecode
from urllib.parse import unquote
from django.db.models import Q
from django.urls import reverse
from django_filters import rest_framework as filters
from drf_spectacular.utils import extend_schema, inline_serializer
from packageurl import PackageURL
from rest_framework import serializers, viewsets, mixins
from rest_framework.decorators import action
{
"headers": [
{
"tool_name": "scancode-toolkit",
"tool_version": "21.3.1",
"options": {
"input": [
"fsolver.txt"
],
"--copyright": true,
@pombredanne
pombredanne / flashtext_regex_timing_keyword_extraction.py
Created March 7, 2021 15:08 — forked from vi3k6i5/flashtext_regex_timing_keyword_extraction.py
Benchmarking timing performance Keyword Extraction between regex and flashtext
#!/bin/python
from flashtext.keyword import KeywordProcessor
import random
import string
import re
import time
def get_word_of_length(str_length):
# generate a random word of given length
return ''.join(random.choice(string.ascii_lowercase) for _ in range(str_length))
@pombredanne
pombredanne / TorPrivoxyPython.md
Created November 18, 2020 14:26 — forked from DusanMadar/TorPrivoxyPython.md
A step-by-step guide how to use Python with Tor and Privoxy

A step-by-step guide how to use Python with Tor and Privoxy

Tested on Ubuntu 18.04 Docker container. The Dockerfile is a single line FROM ubuntu:18.04. Alternatively, you can simply run docker run -it ubuntu:18.04 bash.

NOTE: stopping services didn't work for me for some reason. That's why there is kill $(pidof <service name>) after each failed service <service name> stop to kill it.

References

This guide is basically a compilation of all the resources listed below.

@pombredanne
pombredanne / js-crc32
Created October 6, 2020 15:30 — forked from elebetsamer/js-crc32
A javascript CRC32. Original code from http://stackoverflow.com/questions/18638900/javascript-crc32 (and http://jsperf.com/js-crc32). Does not support UTF8
var makeCRCTable = function(){
var c;
var crcTable = [];
for(var n =0; n < 256; n++){
c = n;
for(var k =0; k < 8; k++){
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
crcTable[n] = c;
}
@pombredanne
pombredanne / mvn_cve_graphql_probe
Created July 21, 2020 16:38 — forked from inksong/mvn_cve_graphql_probe
Query for Github GraphQL API
{
securityVulnerabilities(ecosystem: MAVEN, first: 100) {
nodes {
package {
name
ecosystem
}
vulnerableVersionRange
severity
updatedAt
@pombredanne
pombredanne / upload_release_assets.py
Created July 8, 2020 12:35 — forked from zonca/upload_release_assets.py
Upload release assets to Github from the command line
"""Upload release assets to a GitHub release
First create a release on Github, then:
python upload_release_assets.py 1.2.0 my_data.tgz
"""
import sys
REPOSITORY="your_organization/your_repo"
with open("GITHUB_TOKEN") as f:
TOKEN=f.read().strip()
from github import Github
@pombredanne
pombredanne / export_repo_issues_to_csv.py
Created June 13, 2020 07:01 — forked from unbracketed/export_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests
@pombredanne
pombredanne / rename_app.py
Created April 17, 2020 08:57 — forked from rafaponieman/rename_app.py
Django rename app management command
import argparse
from django.core.management.base import BaseCommand
from django.db import connection
class Command(BaseCommand):
help = 'Renames app. Usage rename_app [old_name] [new_name] [classes ...]'
def add_arguments(self, parser):