Skip to content

Instantly share code, notes, and snippets.

View suminb's full-sized avatar

Sumin Byeon suminb

View GitHub Profile
@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
@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"'
@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
@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)

@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)
@luke
luke / bulkupsert.py
Last active March 17, 2023 19:30
I needed to upsert (insert or update) bajillions of records into postgresql. After trying various libs including upsert (which was slow as hell) I ended up doing a bit of research and trying 3 different methods. This one won. While I'm manually building the sql string no user data is passed in. Its loaded via the copy from statement as CSV. Call…
import logging
import cStringIO
import csv
DEBUG = False
def data2csv(data):
si = cStringIO.StringIO()
cw = csv.writer(si, delimiter='\t',lineterminator="\n")
for row in data:
@cridenour
cridenour / gist:74e7635275331d5afa6b
Last active August 7, 2023 13:52
Setting up Vim as your Go IDE

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

@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"
@DazWorrall
DazWorrall / app.py
Created July 26, 2012 07:54
Flask maintenance mode
from flask import Flask, redirect, url_for, request
app = Flask(__name__)
is_maintenance_mode = True
# Always throw a 503 during maintenance: http://is.gd/DksGDm
@app.before_request
def check_for_maintenance():
@hashmal
hashmal / gist:874792
Created March 17, 2011 17:54
[Lua] Print table contents recursively
-- Print contents of `tbl`, with indentation.
-- `indent` sets the initial level of indentation.
function tprint (tbl, indent)
if not indent then indent = 0 end
for k, v in pairs(tbl) do
formatting = string.rep(" ", indent) .. k .. ": "
if type(v) == "table" then
print(formatting)
tprint(v, indent+1)
else