Skip to content

Instantly share code, notes, and snippets.

View auser's full-sized avatar

Ari auser

View GitHub Profile
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
@pratimsc
pratimsc / docker-compose.yml
Last active March 27, 2017 21:45
A docker compose file for creating API Gateway protecting Microservices
##################################################################
# Docker Compose file that starts Clustered Kong API Gateway #
##################################################################
version: "3"
#################################################################
#
# NETWORKS
#
@geoffrepoli
geoffrepoli / List all third-party software and their version numbers
Last active November 16, 2022 16:03
lists all non-Apple applications names and versions, separated by "-" delimiter
find /Applications -name *.app -maxdepth 2 -exec \
bash -c '[[ ! $(defaults read "{}"/Contents/Info.plist CFBundleIdentifier) =~ "com.apple" ]] \
&& echo "$(basename "{}" | sed 's/.app.*//')-$(defaults read "{}"/Contents/Info.plist CFBundleShortVersionString)"' \;
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@bruce
bruce / schema.ex
Created January 3, 2017 07:51
Quick, dirty (and untested) example of using import_types and import_fields
defmodule MyApp.Schema do
use Absinthe.Schema
import_types MyApp.Schema.Query.User
query do
import_fields :user_queries
end
end
@tomconte
tomconte / web3-solc-contract-compile-deploy.js
Created December 13, 2016 09:32
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@geddski
geddski / Avatar.js
Created November 10, 2016 23:01
Angular 1 component helper for rendering components directly
/**
* A sample Angular 1 component, created using the component helper above.
* Uses Aphrodite for CSS
*/
import component from './component';
import { StyleSheet, css } from 'aphrodite';
const styles = StyleSheet.create({
avatar: {
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@NelsonBrandao
NelsonBrandao / Button.js
Created September 10, 2016 16:29
React Native Example (Login Screen + Session Service + OAuth)
import React, { Component, PropTypes } from 'react';
import {
View,
Text,
Platform,
StyleSheet,
TouchableHighlight,
TouchableNativeFeedback
} from 'react-native';