Skip to content

Instantly share code, notes, and snippets.

View suminb's full-sized avatar

Sumin Byeon suminb

View GitHub Profile
@hmldd
hmldd / scroll.py
Last active October 6, 2023 14:59
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@xnuk
xnuk / hyeong.md
Last active February 11, 2024 15:10
난해한 혀엉.... 언어

이 문서가 여기저기 알려짐에 따라, 이곳에 여러가지 댓글이 달리고 있습니다. 개인적으로는 댓글창을 없애버리고 싶지만 그럴 수 없는 터라, 댓글을 달기 전에 한번씩만 더 생각해주셨으면 합니다.

  • 개인적인 감상은 이곳이 아닌 다른 곳에 적어주세요.
  • 동성애 혐오적인 댓글을 달지 마세요.
  • 기타 "난해한 혀엉... 언어"와 관련없는 댓글을 달지 말아주세요.

위 사항들을 포함해 제 마음에 안 드는 댓글들은 임의로 삭제하고 있습니다. 양해 부탁드립니다.


@larryli
larryli / GIT_SSH_COMMAND.sh
Last active January 21, 2021 20:35
Git ssh socks proxy
#!/bin/sh
export GIT_SSH_COMMAND='ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git config --global core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git clone -c=core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"' git@github.com:larryli/ipv4.git
git config core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
@davidrpmorris
davidrpmorris / wtforms_fieldlist_json.py
Last active March 16, 2023 16:59
WTForms FormField with FieldList with JSON column type
# Skip to Line 56 to see how to set things up with JSON
# Normally each FormField is represented by its own row in a database. In this example
# each FormField is a row in the Specification table.
# models.py
class Specification(db.Model):
...
name = db.Column(db.String)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@gene1wood
gene1wood / example_aws_lambda_cloudformation_context.md
Last active January 4, 2023 06:41
Details on the AWS Lambda Python LambdaContext context object when instantiated from a CloudFormation stack

LambdaContext

Here is the raw output from examining the Python LambdaContext context object in a AWS Lambda function when called from a CloudFormation stack. More information on the context object can be found here : http://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)

@cube-drone
cube-drone / gist:c7c59002fe072ab9c775
Last active December 5, 2016 21:05
20% of Software is Diva Bullshit

Some examples of diva bullshit from your developers:

  • correctness as an assertion of dominance
  • my religion is the one true religion (Python? You should use node for that. Node? You should use Scala for that.)
  • insisting on technologies that ‘scale linearly’ when developing services that clearly will not serve more than 100,000 people and can probably comfortably be served from one computer.
  • a coffee incantation that requires any of the following:
    • a $300+ espresso machine
    • an aeropress
    • a scale
  • temperature measurements
@chrahunt
chrahunt / se-image-paste.user.js
Last active December 30, 2021 11:50
Add image-pasting capability to StackEdit markdown editor.
// ==UserScript==
// @name StackEdit Image Extension
// @namespace http://chri.sh/
// @version 0.4.1
// @description Add image-pasting capability to StackEdit editor.
// @author chrahunt
// @match https://stackedit.io/editor
// @run-at document-end
// @grant none
// @downloadURL https://gist.github.com/chrahunt/c27686b095a390c26ff8/raw/se-image-paste.user.js
@phybros
phybros / update-route53.sh
Last active February 12, 2024 00:07
BASH Script to keep Route53 updated with your current external IP address
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID="enter zone id here"
# The CNAME you want to update e.g. hello.example.com