Skip to content

Instantly share code, notes, and snippets.

@com3345
com3345 / untitled.py
Created January 10, 2018 12:08
indeed interview
'''
moving avg,就是一个stream输入,
给一个int getNow()API获取当前timestamp,
完成两个函数void record(int value)和double getAvg(),
有输入时会自动call record,然后call getAvg()时返回5分钟内的平均值。
getMedium -> quick select
'''
from collections import deque
@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active January 24, 2024 00:30
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@zedar
zedar / ApacheHadoop_NativeLibs.adoc
Last active August 13, 2020 00:59
Add native libraries to Apache Hadoop installation

Apache Hadoop - add native libraries

If native libraries are not available the following message is displayed with every hadoop command: hadoop checknative

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  • Clone hadoop source code


@necolas
necolas / CustomView.jsx
Last active September 15, 2015 09:12
React Web Style-API
import ReactWebStyle, {WebComponent} from 'react-web-style';
import React, {PropTypes} from 'react';
import {Text, View} from 'react-web-sdk';
const styles = {
root: {
borderColor: 'red',
padding: '10px',
position: 'absolute',
@Epigene
Epigene / MB puma + Nginx settings
Last active December 28, 2020 19:35
MB puma + Nginx settings
# /config/puma.rb
app = "manabalss" # App-specific
root = "/home/deployer/apps/#{app}"
workers 5
threads 1, 1 # relying on many workers for thread-unsafe apps
rackup DefaultRackup
port 11592
@softwaredoug
softwaredoug / ubuntu_py3.md
Last active November 9, 2021 19:38
Ubuntu 14.04 Python 3.4.2 Setup using pyenv and pyvenv

What I did to get Python 3.4.2 on Ubuntu 14.04. The stock version of Python 3 on Ubuntu is 3.4.0. Which is missing some of the best parts! (asyncio, etc). Luckily I discovered pyenv which solved my problem.

Install pyenv

Pyenv (not to be confused with pyvenv) is the Python equivelant of rbenv. It lets you configure which Python environment/version is available per directory, user, or other session variables.

I followed the instructions here to install pyenv in my home directory. Verbatem, those instructions are:

sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
@dapangmao
dapangmao / Linkedlist.md
Last active June 15, 2021 17:56
Linked List
  • Transform list to linked list
class ListNode:
    def __init__(self, val=None):
        self.val = val
        self.next = None
        self.size = 0
        if val:
            self.size = 1
    def add_to_last(self, x):
@lfender6445
lfender6445 / gist:9919357
Last active May 2, 2024 22:40
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@zdwolfe
zdwolfe / gist:6721115
Last active October 1, 2018 06:38
Basic nginx configuration for AngularJS html5Mode
server {
listen 0.0.0.0:12345;
location / {
root /home/zdwolfe/src/angularAWS/app;
try_files $uri $uri/ /index.html =404;
}
}