Skip to content

Instantly share code, notes, and snippets.

@rahulyhg
rahulyhg / laravellocal.md
Created March 23, 2019 12:59 — forked from hootlex/laravellocal.md
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
public class LocationActivity extends AppCompatActivity
implements LocationContract.View {
@BindView(R.id.latitudeTextView)
TextView latitudeTextView;
@BindView(R.id.longitudeTextView)
TextView longitudeTextView;
@BindView(R.id.softDenyTextView)
TextView softDeniedWarningTextView;
@BindView(R.id.hardDenyTextView)
//Main activity for adding Location based mutes
package com.zeeshanak.mutemehere;
import java.util.ArrayList;
import java.util.List;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
<?php
// Demo for session fixation
//
// Attacker creates a session by visiting the page: http://famfamfam.com/sessionfixation.php
// Attacker gets their session ID out of the cookie (or in this case from the page)
// Attacker creates a URL such as http://famfamfam.com/sessionfixation.php?PHPSESSID=attackerssessionid and sends it to victim
// Victim clicks the URL (now both the attacker and victim are using the same session)
// Victim logs in
// Now the attacker is logged in to the victim's account too (same session!)
@rahulyhg
rahulyhg / example.php
Created January 3, 2019 11:21 — forked from juzna/example.php
SessionId and randomness in PHP
<?php
/**
* Starts a PHP session and dump a random number
*/
session_start();
// do some stuff...
$password = mt_rand();
$otherRandomToken = rand();
@rahulyhg
rahulyhg / MySQLSession.php
Created January 3, 2019 11:19 — forked from rjha/MySQLSession.php
PHP MYSQL based session handler with locking using select for update
<?php
namespace com\indigloo\core {
use \com\indigloo\Configuration as Config;
use \com\indigloo\mysql\PDOWrapper;
use \com\indigloo\Logger as Logger;
/*
* custom session handler to store PHP session data into mysql DB
@rahulyhg
rahulyhg / twilight.py
Created November 6, 2017 13:09 — forked from tricoder42/twilight.py
Show times for dusk, dawn, sunset and sunrise.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: twilight.py [--city=<city> | --coordinates=<coordinates>]
[--date=<date> | --tomorrow] [--week]
[-h | --help | --version]
Options:
-h --help Show this help.
--version Show version.