Skip to content

Instantly share code, notes, and snippets.

View umutyerebakmaz's full-sized avatar
:octocat:
I'm available, please open an issue on the subject.

Umut Yerebakmaz umutyerebakmaz

:octocat:
I'm available, please open an issue on the subject.
View GitHub Profile
<?php
function ifconfig() {
preg_match("/^([A-z]\*\d)\s+Link\s+encap:([A-z]\*)\s+HWaddr\s+([A-z0-9:]\*).\*".
"inet addr:([0-9.]+).\*Bcast:([0-9.]+).\*Mask:([0-9.]+).*".
"MTU:([0-9.]+).\*Metric:([0-9.]+).\*".
"RX packets:([0-9.]+).\*errors:([0-9.]+).\*dropped:([0-9.]+).\*overruns:([0-9.]+).\*frame:([0-9.]+).*".
"TX packets:([0-9.]+).\*errors:([0-9.]+).\*dropped:([0-9.]+).\*overruns:([0-9.]+).\*carrier:([0-9.]+).*".
"RX bytes:([0-9.]+).\*\((.\*)\).*TX bytes:([0-9.]+).\*\((.\*)\)".
"/ims", $int, $regex);
@cschaba
cschaba / gist:4740380
Created February 8, 2013 17:01
PHP: parse output of ifconfig (tested with Ubuntu Linux)
<?php
// from http://www.highonphp.com/regex-pattern-parsing-ifconfig
$data = <<<EOF
eth0 Link encap:Ethernet HWaddr 00:50:56:33:B6:D2
inet addr:192.168.12.103 Bcast:192.168.12.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1337 errors:0 dropped:0 overruns:0 frame:0
TX packets:985 errors:0 dropped:0 overruns:0 carrier:0
@dimitardanailov
dimitardanailov / sample-nginx.conf
Last active August 20, 2021 17:41
Configuration for Laravel 5 application and Nginx
server {
listen 80 default deferred;
server_name laravel-application.com;
# http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
access_log /var/www/laravel-app/access.log;
error_log /var/www/laravel-app/error.log;
root /var/www/laravel-app/public/;
@rukshn
rukshn / district-picker.blade.php
Last active November 10, 2021 18:18
Simple Blade Components
@props(['value', 'name'])
@php
$districts = ['Ampara', 'Anuradhapura', 'Badulla', 'Batticaloa', 'Colombo',
'Galle', 'Gampaha', 'Hambanthota', 'Jaffna', 'Kaluthara', 'Kandy',
'Kegalle', 'Killinochchi', 'Kurunagala', 'Mannar', 'Matale', 'Mathara',
'Monaragala', 'Mullathivu', 'Nuwara Eliya', 'Polonnaruwa', 'Puttalam',
'Rathnapura', 'Trincomalee', 'Vavuniya']
@endphp
@schnell18
schnell18 / macosx_remove_java9.sh
Created October 8, 2016 13:26
MacOS X remove Java 9
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@davidpiesse
davidpiesse / tailwind_md_all_colours.js
Last active April 5, 2024 14:55
A colour set for Tailwind CSS that include all Material Design Colours, shades, accents and contrast colours
// https://davidpiesse.github.io/tailwind-md-colours/
//
//Notes
//
//All colours are generated from Material Design Docs
//Colours have a base, a set of shades (50-900) accent colours
//In addition a companion set of contrast colours are included for colouring text / icons
// Example usage
// class="w-full bg-red-600 text-red-600-constrast"

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.