Skip to content

Instantly share code, notes, and snippets.

consider multiple solutions, commit on one, and iterate

Yuchen yzhong52

consider multiple solutions, commit on one, and iterate
View GitHub Profile
yzhong52 /
Created Sep 2, 2019
Differences between Numpy array and regular python array

In regular python array, a slice view of an array is actually a copy. Modifiying elements through the slice won't affect the original array.

>>> arr = [0, 1, 2]
>>> arr[0:][0] = 100
>>> arr
[0, 1, 2]
JT501 / UIReusable+Rx.swift
Created Sep 3, 2018
An extension to avoid duplicate subscriptions in UITableCell & UICollectionViewCell
View UIReusable+Rx.swift
// Created by Johnny on 3/9/2018.
// Copyright (c) 2018 All rights reserved.
import UIKit
import RxCocoa
import RxSwift
private var prepareForReuseBag: Int8 = 0
yzhong52 /
Last active Aug 19, 2017
Sublime Text Settings: Auto Intent, Tap to Spaces, Rulers

Preferences > Key Bindings:

    { "keys": ["alt+command+l"], "command": "reindent" , "args": {"single_line": false}}

Preferences > Settings:

brablc / dnsmasq
Last active Apr 2, 2021 — forked from ogrrd/dnsmasq OS
Setup dnsmasq on OS X
View dnsmasq

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.



smswz / GridLayout.swift
Last active Mar 12, 2021
A simple custom grid UICollectionViewLayout
View GridLayout.swift
// MIT License
// Copyright (c) 2016 stable|kernel
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
kevin-smets /
Last active Mar 20, 2021
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry


Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!


wgins /
Last active May 31, 2018 — forked from marinamixpanel/
Mixpanel - Exporting people profiles to CSV
''' people export'''
import base64
import csv
import sys
import time
import urllib # for url encoding
import urllib2 # for sending requests
Wenchy / Makefile
Last active Apr 5, 2021
Compile all .cpp files into one target under the current directory.
View Makefile
CC := g++
CFLAGS := -Wall -g
TARGET := test
# $(wildcard *.cpp /xxx/xxx/*.cpp): get all .cpp files from the current directory and dir "/xxx/xxx/"
SRCS := $(wildcard *.cpp)
# $(patsubst %.cpp,%.o,$(SRCS)): substitute all ".cpp" file name strings to ".o" file name strings
OBJS := $(patsubst %.cpp,%.o,$(SRCS))
all: $(TARGET)
jrudolph / TestMultipartFileUpload.scala
Last active May 21, 2020
akka-http Multipart file-upload client + server example
View TestMultipartFileUpload.scala
package akka.http.scaladsl
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.util.ByteString
import scala.concurrent.duration._
scripting / sendToSlack.js
Last active May 12, 2020
A tiny JavaScript app that sends a message to your default Slack channel. Can be customized with a name, icon, emoji or sent to a different channel. Runs in Node.js.
View sendToSlack.js
var request = require ("request");
var urlWebHook = ""; //the URL you get on your "incoming web hooks" page.
function sendToSlack (s, theUsername, theIconUrl, theIconEmoji, theChannel) {
var payload = {
text: s
if (theUsername !== undefined) {
payload.username = theUsername;