Skip to content

Instantly share code, notes, and snippets.

View juan-fdz-hawa's full-sized avatar
🏠
Working from home

Juan Fernandez juan-fdz-hawa

🏠
Working from home
  • Self-employed
  • Dominican Republic
View GitHub Profile
import json
import csv
from collections import defaultdict
from difflib import SequenceMatcher
from functools import lru_cache
nvd = None
with open('extract.json', 'r') as f_handler:
nvd = json.load(f_handler)
@juan-fdz-hawa
juan-fdz-hawa / extractor.py
Created June 28, 2022 01:13
Extracts the vendor and product portions from the NVD dataset
import xml.etree.ElementTree as et
from collections import defaultdict
import json
data = []
path = "cpe-dictionary_v2.3.xml"
context = et.iterparse(path, events=("start", "end"))
context = iter(context)
from django.core.management.base import BaseCommand
from search_seo.models import SeoTemplate
from itertools import product
from django.apps import apps
import os
import time
class Command(BaseCommand):
help = "Migrate location category content to the db"
{
"payment_intent_data": {
"capture_method": "manual",
"setup_future_usage": "off_session",
"metadata": {},
"payment_method_types": ["card"],
"billing_address_collection": "required",
"customer": #..,
"line_items": [{
"name": #...,
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb shell setprop debug.firebase.analytics.app com.getmyboat_v1
adb logcat -v time -s FA FA-SVC
ps ax | grep spring | cut -f1 -d' ' | xargs kill
pp App::V1::Resources::Positions.routes.map { |route| "#{route.request_method}-#{route.path}"}
<%= f.input :author,
:as => :grouped_select,
:collection => [['Authors', ['Jose', 'Carlos']], ['General', ['Bob', 'John']]],
:group_method => :last %>
<%= f.input :author,
:as => :grouped_select,
:collection => Proc.new { [['Authors', ['Jose', 'Carlos']], ['General', ['Bob', 'John']]] },
:group_method => :last %>
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@juan-fdz-hawa
juan-fdz-hawa / delete-from-repo.md
Created November 9, 2018 11:19 — forked from scy/delete-from-repo.md
How to delete a file from a Git repository, but not other users' working copies

How to delete a file from a Git repository, but not other users' working copies

Suppose you have, by mistake, added your IDE's project folder (you know, these .idea folders with all kinds of local paths and configuration data and settings in it) to the Git repository of your project. (We're talking about a whole folder here, but the same rules apply to individual files as well.)

Of course, you only realize that two days after the fact and have already pushed it, and your colleagues have already pulled it. They use the same IDE as you do, so whenever they change a setting or fix paths, they can either

  • commit that, causing nasty merge conflicts for you and others or
  • ignore the changes and carry around a modified file until the end of time without ever committing it.

Why .gitignore won't help