Skip to content

Instantly share code, notes, and snippets.

View asjustas's full-sized avatar

Justas asjustas

  • Vilnius, Lietuva
View GitHub Profile
@mattattui
mattattui / hash_pbkdf2.php
Last active May 17, 2016 09:23
PHP PBKDF2 implementation
<?php
/* PHP PBKDF2 implementation
*
* PBKDF2 is a key derivation function defined in RFC2898. It's used to
* generate longer and more secure passwords from short, human-entered
* passwords. The number of rounds can be increased to keep ahead of
* improvements in CPU/GPU performance.
*
* You should use a different salt for each password (it's safe to store it
@stesla
stesla / echo.go
Created February 17, 2012 16:16
A simple websocket echo server
package main
import (
"net/http"
"io"
"code.google.com/p/go.net/websocket"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@peterjmit
peterjmit / doctrine_cache_driver.php
Created March 6, 2012 17:47
Get the Result Cache from the doctrine entity manager
<?php
class Foo
{
private $_em;
public function __construct($entity_manager)
{
$this->_em = $entityManager;
}
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 22, 2024 12:48
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@drobinson
drobinson / xdebug_settings.ini
Last active June 23, 2020 19:34
Xdebug settings for debugging using remote hosts and how to debug cli php scripts
zend_extension= /usr/lib/php/20170718/xdebug.so
[xdebug]
; This is the default, but just to be sure...
xdebug.remote_port = 9000
; Make sure vmhost is set in /etc/hosts as the ip address of your host machine
; from your virtual machine (set in virtual box as the host-only adapter ip)
@kendellfab
kendellfab / golang-json-marshall
Created August 16, 2013 22:35
Handling custom Json marshalling in golang.
type Whatever struct {
someField int
}
func (w Whatever) MarshalJSON() ([]byte, error) {
return json.Marshal(struct{
SomeField int `json:"some_field"`
}{
SomeField: w.someField,
})
@kulikov
kulikov / nsq.conf
Created August 21, 2013 14:58
Supervisord config for NSQ — http://bitly.github.io/nsq/
[program:nsqlookupd]
command=/usr/local/nsq/bin/nsqlookupd --http-address="10.36.206.254:4161" --tcp-address="10.36.206.254:4160"
process_name=%(program_name)s
numprocs=1
directory=/usr/local/nsq
user=ubuntu
stdout_logfile=/var/log/nsq/nsqlookupd.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=5
redirect_stderr=true
@dmitshur
dmitshur / gist:6927554
Last active July 14, 2024 16:13
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.
@alexsegura
alexsegura / gist:9895452
Created March 31, 2014 15:52
Get MySQL error code with Doctrine DBAL
<?php
$sql = '...';
$stmt = $conn->prepare($sql);
try {
$stmt->execute();
} catch (\Doctrine\DBAL\DBALException $e) {
$previous = $e->getPrevious();
@ruzickap
ruzickap / openwrt_wireless.sh
Created April 6, 2014 16:55
OpenWrt WiFi configuration tweaks
uci set wireless.radio0.channel=8
uci set wireless.radio0.htmode=HT40-
uci set wireless.radio0.noscan=1
uci set wireless.radio0.bursting=1
uci set wireless.radio0.ff=1
uci set wireless.radio0.compression=1
uci set wireless.radio0.xr=1
uci set wireless.radio0.ar=1
uci set wireless.radio0.txpower=20