Skip to content

Instantly share code, notes, and snippets.

View samukweku's full-sized avatar

Samuel Oranyeli samukweku

View GitHub Profile
@wtbarnes
wtbarnes / push-to-someone-elses-pr.md
Created March 5, 2020 04:49
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

@ola-sk
ola-sk / counting and finding.cpp
Last active November 21, 2021 20:29
C++ STL Algorithms
#include <vector>
#include <string>
#include <algorithm>
#include <map>
int main()
{
std::vector<int> v { 2, 5, 7, 1, 0, 6, 6, 2, -2, 4, 4, 7, 9, 0, 5 }; //6 odd values
//——————————————————————————————————————————————————————————————————————————
@duncangh
duncangh / s3_to_pandas.py
Created April 7, 2019 03:01 — forked from jaklinger/s3_to_pandas.py
Read CSV (or JSON etc) from AWS S3 to a Pandas dataframe
import boto3
import pandas as pd
from io import BytesIO
bucket, filename = "bucket_name", "filename.csv"
s3 = boto3.resource('s3')
obj = s3.Object(bucket, filename)
with BytesIO(obj.get()['Body'].read()) as bio:
df = pd.read_csv(bio)
@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@showa-yojyo
showa-yojyo / ipython-history-recall-demo.txt
Created August 15, 2016 14:51
How to use %history and %recall in IPython.
In [12]: %history?
Docstring:
::
%history [-n] [-o] [-p] [-t] [-f FILENAME] [-g [PATTERN [PATTERN ...]]]
[-l [LIMIT]] [-u]
[range [range ...]]
Print input history (_i<n> variables), with most recent last.
@IanHopkinson
IanHopkinson / lxml_examples.py
Created November 24, 2015 19:42
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">