Skip to content

Instantly share code, notes, and snippets.

View yehjames's full-sized avatar

James Yeh yehjames

  • Dcard
  • Taiwan, Taipei
View GitHub Profile
@pemagrg1
pemagrg1 / convert_envyml_to_reqtxt
Created April 22, 2020 17:51
convert environment.yml to requirement.txt
import ruamel.yaml
yaml = ruamel.yaml.YAML()
data = yaml.load(open('environment.yml'))
requirements = []
for dep in data['dependencies']:
if isinstance(dep, str):
package, package_version, python_version = dep.split('=')
if python_version == '0':
@fomightez
fomightez / useful_pandas_snippets.py
Last active April 19, 2024 18:25 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
df['Column Name'].unique()
# To extract a specific column (subset the dataframe), you can use [ ] (brackets) or attribute notation.
df.height
df['height']
# are same thing!!! (from http://www.stephaniehicks.com/learnPython/pages/pandas.html
# -or-
# http://www.datacarpentry.org/python-ecology-lesson/02-index-slice-subset/)

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@dpavlic
dpavlic / EXECUTABLE_MAGIC
Created February 15, 2016 03:34
make `hydrogen` work with remote kernel
#!/usr/bin/env bash
local_json=$1
remote_ip=$2
remote_json=$3
remote_json_on_local=$(jupyter --runtime-dir)/remote.json
scp $remote_ip:$remote_json $remote_json_on_local
for socket_name in hb_port control_port stdin_port iopub_port shell_port; do
local_port=$(sed 's/,/\n/g' $local_json | grep $socket_name | grep -o "[0-9]\+")
remote_port=$(grep $socket_name $remote_json_on_local | grep -o "[0-9]\+")
@dannvix
dannvix / intercept-https-with-python-mitmproxy.md
Last active February 16, 2023 02:43
Intercept and manipulate HTTPs traffic with Python and mitmproxy

Intercepts HTTPs Traffic with Python & mitmproxy

Warning

This Gist is created in 2014, and it's highliy outdated now, according to one of mitmproxy's manjor contributor (check his comment below). Thanks for letting us know, @mhils!

Introduction

Modern applications usually make use of back-end API servers to provide their services. With a non-transparent HTTPs proxy, which intercepts the communication between clients and servers (aka the man-in-the-middle scheme), you can easily manipulate both API requests and responses.