Skip to content

Instantly share code, notes, and snippets.

@shivas
shivas / bcrypt.php
Created July 5, 2012 08:44 — forked from dzuelke/bcrypt.php
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
// just an example; please use something more secure/random than sha1(microtime) :)
$salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22);
// 2a is the bcrypt algorithm selector, see http://php.net/crypt
@shivas
shivas / nginx.conf
Created September 21, 2012 23:28 — forked from leon/nginx.conf
Nginx PHP-FPM Symfony 2 minimal config
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@shivas
shivas / gist:4009228
Created November 3, 2012 23:01
bash git prompt
# Display unstaged (*) and staged(+) changes
export GIT_PS1_SHOWDIRTYSTATE="1"
# Display whether there are stashed ($) changes
export GIT_PS1_SHOWSTASHSTATE="1"
# Display if there are untracked (%) files
export GIT_PS1_SHOWUNTRACKEDFILES="1"
# Display if we're ahead (>) or behind (<) or diverged (<>) relative
# to upstream
export GIT_PS1_SHOWUPSTREAM="auto"
# An experiment for a capistrano 'stage' that can actually be used to
# deploy multiple feature branches at once.
# Intended to be installed config/deploy/feature_demo , when using cap
# multi-stage support: add 'feature_demo' to 'stages' in `config/deploy.rb` too.
# Run from a git feature branch `cap feature_demo deploy` to deploy to
# single machine we have all our feature demos on.
# Name of feature branch will be taken from current git checkout.
@shivas
shivas / deploy.rb
Created September 11, 2013 21:49 — forked from JCook21/deploy.rb
# Deployment server info
set :application, "APP NAME"
set :domain, "APP DOMAIN NAME"
set :deploy_to, "/path/on/live/server"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
# SCM info
set :repository, "GIT REMOTE REPO URL"
@shivas
shivas / compile-php-thread-safe-and-pthreads.sh
Created February 8, 2016 10:01 — forked from Divi/compile-php-thread-safe-and-pthreads.sh
Compile PHP Thread Safe & pthreads extension
#!/usr/bin/env bash
# PARAMETERS
# ----------
# PHP
# ---
PHP_TIMEZONE="UTC"
PHP_DIRECTORY="/etc/php5ts"
@shivas
shivas / prometheus.sh
Created August 3, 2018 13:43 — forked from petarnikolovski/prometheus.sh
Prometheus 2.x installation on Ubuntu 16.04 server.
#!/bin/bash
# Ubuntu 16.04
# Prometheus installation. It's a lousy script though.
# Example:
# chmod +x prometheus.sh
# sudo pwd
# ./prometheus.sh
@shivas
shivas / github-workflows-goreleaser.yml
Created November 27, 2019 15:34 — forked from markbates/github-workflows-goreleaser.yml
Run Go tests in Windows, Mac, Linux. Go version 1.12/1.13 both with Modules and GOPATH.
name: Release
on:
release:
types:
- published
jobs:
release:
name: Release
runs-on: ubuntu-latest
@shivas
shivas / ss.go
Created November 2, 2020 01:19 — forked from rgl/ss.go
take a screenshot of a specific Windows application window in pure Go
// +build windows
package screen
import (
"fmt"
"image"
"reflect"
"syscall"
"unsafe"
@shivas
shivas / main.go
Created November 11, 2020 20:40
ComboBox reproducible issue
package main
import (
"fmt"
"log"
"syscall"
"time"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"