Skip to content

Instantly share code, notes, and snippets.

View appkr's full-sized avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@wzed
wzed / guzzle_pool_example.php
Created February 8, 2017 08:57
GuzzleHttp\Pool example: identifying responses to concurrent async requests
<?php
/*
* Using a key => value pair with the yield keyword is
* the cleanest method I could find to add identifiers or tags
* to asynchronous concurrent requests in Guzzle,
* so you can identify which response is from which request!
*/
$client = new GuzzleHttp\Client(['base_uri' => 'http://httpbin.org']);
@HomoEfficio
HomoEfficio / 0-CustomSerializationMain.java
Last active July 15, 2021 10:59
Jackson Custom Serializer
package homo.efficio.json.jackson.custom.serialization;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import homo.efficio.json.jackson.custom.serialization.domain.CellPhone;
import homo.efficio.json.jackson.custom.serialization.domain.FamilyMember;
import homo.efficio.json.jackson.custom.serialization.domain.MobileVendor;
import homo.efficio.json.jackson.custom.serialization.serializer.CellPhoneSerializer;
import homo.efficio.json.jackson.custom.serialization.serializer.FamilyMemberSerializer;
@themsaid
themsaid / HasEnums.php
Last active August 29, 2020 23:23
PHP Enumerated Type
trait HasEnums
{
/**
* The array of enumerators of a given group.
*
* @param null|string $group
* @return array
*/
static function enums($group = null)
{
@lesstif
lesstif / serve-php.sh
Last active March 21, 2021 06:23
nginx php-fpm virtual host serve script for RHEL/CentOS, Ubuntu distro. Run "curl -o serve-php.sh https://gist.githubusercontent.com/lesstif/82c107282241c7a52ad9/raw && sudo mv serve-php.sh /usr/local/bin/ && sudo chmod +x /usr/local/bin/serve-php.sh "
#!/usr/bin/env bash
## Installation
## curl -o /usr/local/bin/serve-php.sh https://gist.githubusercontent.com/lesstif/82c107282241c7a52ad9/raw
## chmod +x /usr/local/bin/serve-php.sh
SA="/etc/nginx/sites-available/"
SE="/etc/nginx/sites-enabled/"
test=0
@appkr
appkr / Contract Killer 3.md
Created February 27, 2016 12:58 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@cmaas
cmaas / CastsValueObject.php
Last active March 21, 2020 12:56
A Trait to automatically cast value objects in Laravel without needing a Mutator and an Accessor.
<?php
trait CastsValueObjects
{
protected function castAttribute($key, $value)
{
$castToClass = $this->getValueObjectCastType($key);
// no Value Object? simply pass this up to the parent
if (!$castToClass) {
return parent::castAttribute($key, $value);
@haje01
haje01 / TensorFlow 시작하기.md
Last active May 3, 2024 07:30
TensorFlow 시작하기

텐서플로우 시작하기

글쓴이: 김정주(haje01@gmail.com)

이 문서는 텐서플로우 공식 페이지 내용을 바탕으로 만들어졌습니다.


소개

텐서플로우(TensorFlow)는 기계 학습과 딥러닝을 위해 구글에서 만든 오픈소스 라이브러리입니다. 데이터 플로우 그래프(Data Flow Graph) 방식을 사용하였습니다.

@nkt
nkt / Results.md
Last active September 27, 2023 08:24
ReactPHP vs Node.js

wrk -t4 -c400 -d10s http://127.0.0.1:1337/

PHP

Running 10s test @ http://127.0.0.1:1337/
  4 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
 Latency 7.02ms 6.94ms 82.86ms 85.27%
@sheck
sheck / seti.css
Created October 18, 2015 04:51
Seti UI Theme for Pygments highlighting (jekyll, github pages)
.highlight .hll { background-color: #ffffcc }
.highlight { background: #151718; color: #d4d7d6; background-color: #151718 }
.highlight .c { color: #41535b; background-color: #151718 } /* Comment */
.highlight .err { color: #d4d7d6; background-color: #151718 } /* Error */
.highlight .esc { color: #d4d7d6; background-color: #151718 } /* Escape */
.highlight .g { color: #d4d7d6; background-color: #151718 } /* Generic */
.highlight .k { color: #9fca56; background-color: #151718 } /* Keyword */
.highlight .l { color: #d4d7d6; background-color: #151718 } /* Literal */
.highlight .n { color: #d4d7d6; background-color: #151718 } /* Name */
.highlight .o { color: #d4d7d6; background-color: #151718 } /* Operator */
@karpathy
karpathy / min-char-rnn.py
Last active May 8, 2024 20:15
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)