Skip to content

Instantly share code, notes, and snippets.

View clbcabral's full-sized avatar

Cleber Cabral clbcabral

View GitHub Profile
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@gjbagrowski
gjbagrowski / ldap_logging.py
Created July 26, 2016 07:34
django-auth-ldap + ldap.forumsys.com
import logging
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
@cuducos
cuducos / bootstrap.sh
Last active August 9, 2019 02:07
Computer Bootstraps
#!/bin/bash
##############################################################################
# Install system packages #
##############################################################################
xcode-select --install
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
# install homebrew
@bouchard
bouchard / download.rb
Created December 31, 2014 23:51
Download Private but Embedded Vimeo Videos
#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http'
require 'shellwords'
require 'json'
source = Net::HTTP.get('www.domain.com', '/thepagethathasthevideos/')
doc = Nokogiri::HTML(source)
ids = doc.css('a').map{ |a| a.attr('data-vimeoid') }.compact.uniq
@orip
orip / GsonHelper.java
Created September 5, 2012 11:22
Gson type adapter to serialize and deserialize byte arrays in base64
import java.lang.reflect.Type;
import android.util.Base64;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git