Skip to content

Instantly share code, notes, and snippets.

View solancer's full-sized avatar
🎯
Focusing

Srinivas Gowda solancer

🎯
Focusing
View GitHub Profile
@solancer
solancer / gist:6e0bab55e97cfb6d0d5b
Created December 16, 2015 00:37 — forked from slivero/gist:3164297
Resampling a JPEG image in PHP using GD (not imagemagick)
<?php
/**
* Class used for resampling images
*/
class Resampler
{
/**
* Resample an image
*
@solancer
solancer / readme.md
Created March 13, 2017 10:56 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@solancer
solancer / Laravel-Perm.sh
Last active December 19, 2017 16:37 — forked from ClaudioVarandas/laravel_perm.sh
Laravel permissions
# add sudo user to www-data group
# usermod on your user. So that would be
sudo usermod -aG www-data srinivas
# set perms with sudo user in accordance with apache user
sudo chown -R srinivas:www-data .
# change group perms of storage and cache folder to exlcusively support only apache user
sudo chgrp -R www-data storage bootstrap/cache
# declare user and group permissions on the same
sudo chmod -R ug+rwx storage bootstrap/cache
# unmask hack to set www-data for newly created files
@solancer
solancer / php-mass-mailer.php
Created October 1, 2017 00:53 — forked from jonaslejon/php-mass-mailer.php
PHP Mass Mailer
<?php
/*
The code below was found during a forensic investigation. It seems to be a mass mailer that is using the PHPMailer class to send mail
from compromised web hosting providers.
The "password" is 5307c392-ad5e-4909-adec-c9fd12572686, see below.
Investigation was made by Jonas Lejon <jonas.githubgist at- triop.se>
The signature for PHP.Trojan.Mailer-1 can only find the packed version of this file.
#!/bin/bash -ex
# SETUP PERMISSIONS
VPATH=${1%/}
GROUP_WEBWORK=${2}
WEBSERVER="www-data"
HELP="\nHelp: This script is used to fix permissions\nPlease provide the following arguments:\n\t 1) Path to web root\n\t 2) Shared workgroup of website. AKA group ownership\nNote: \"www-data\" (apache default) is assumed as the owner of the web files.\n\nUsage: [sudo] bash ${0##*/} [web_root_path] [group_name]\n"
[ -z "$VPATH" ] && VPATH=`pwd` # is null, use present dir
[ -z "$GROUP_WEBWORK" ] && GROUP_WEBWORK=webwork # is null, set default
@solancer
solancer / API.md
Last active February 20, 2018 10:23 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@solancer
solancer / swipeFunc.js
Created January 28, 2020 22:26 — forked from localpcguy/swipeFunc.js
Simple Mobile Swipe function to get the swipe direction
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){
@solancer
solancer / alignments.css
Created January 31, 2020 11:53 — forked from gokulkrishh/alignments.css
CSS Layout - Align an element Horizontal & Vertical center
/* HTML */
<div class="container">
<div class="child"></div>
<div>
/* Basic Style */
.container {
width: 500px;
@solancer
solancer / app.js
Created February 29, 2020 23:20 — forked from pantharshit00/app.js
Simple express app using JWT authentication
/**
* To get started install
* express bodyparser jsonwebtoken express-jwt
* via npm
* command :-
* npm install express bodyparser jsonwebtoken express-jwt --save
*/
// Bringing all the dependencies in
const express = require('express');