Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
consider multiple solutions, commit on one, and iterate

Yuchen yzhong52

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

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
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 Johnny@Co-fire.com. All rights reserved.
//
import UIKit
import RxCocoa
import RxSwift
private var prepareForReuseBag: Int8 = 0
@yzhong52
yzhong52 / readme.md
Last active Aug 19, 2017
Sublime Text Settings: Auto Intent, Tap to Spaces, Rulers
View readme.md

Preferences > Key Bindings:

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

Preferences > Settings:

@brablc
brablc / dnsmasq macOS.md
Last active Aug 26, 2020 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X
View dnsmasq macOS.md

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.

Requirements

Install

@smswz
smswz / GridLayout.swift
Last active Oct 7, 2020
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
kevin-smets / 1_kubernetes_on_macOS.md
Last active Nov 22, 2020
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry
View 1_kubernetes_on_macOS.md

Requirements

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!

Prerequisites

@wgins
wgins / people2csv.py
Last active May 31, 2018 — forked from marinamixpanel/people2csv.py
Mixpanel - Exporting people profiles to CSV
View people2csv.py
''' people export'''
import base64
import csv
import sys
import time
import urllib # for url encoding
import urllib2 # for sending requests
try:
@Wenchy
Wenchy / Makefile
Last active Nov 23, 2020
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
jrudolph / TestMultipartFileUpload.scala
Last active May 21, 2020
akka-http Multipart file-upload client + server example
View TestMultipartFileUpload.scala
package akka.http.scaladsl
import java.io.File
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.util.ByteString
import scala.concurrent.duration._
import akka.actor.ActorSystem
@scripting
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 = "https://hooks.slack.com/services/abcdef"; //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;
You can’t perform that action at this time.