Skip to content

Instantly share code, notes, and snippets.

View vikasavnish's full-sized avatar

Vikas Avnish vikasavnish

  • wizikey
  • Gurgaon
View GitHub Profile
sudo apt-get update
sudo apt-get install apache2
sudo apache2ctl configtest
sudo ufw app list
sudo ufw app info "Apache Full"
sudo ufw allow in "Apache Full"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo apt-get install curl
sudo apt-get install mysql-server
#sudo mysql_secure_installation
#!/bin/bash
#on displays the actual folder name
echo "the folder is 'pwd'"
#then the rest of the files
echo "The folder which contains files are 'ls'"
<style>
input[type=radio]{display: none;}
input[type=radio]+label{width: 30px;border:solid thin #ccc; margin: 20px;display: table-cell;margin:0 10px;padding: 10px;
/* CSS3 */}
input:checked[type=radio]+label{color:white;background-color: green;}
</style>
Working Demo
<input type="radio" name="gender" value="male" id="opt1"><label for="opt1">Option1</label>
//setup
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
// Actual ajax
$.post(submittarget,{data:data},function(e){
console.log(e);
});
import eatiht
url = raw_input()
print eatiht.extract(url)
function parseTime(t1){
t3=t1.split(" ")[1]=='pm'?(parseInt(t1.split(" ")[0].split(":")[0])*60+parseInt(t1.split(" ")[0].split(":")[1])+720):parseInt(t1.split(" ")[0].split(":")[0]*60)+parseInt(t1.split(" ")[0].split(":")[1])
return t3
}
function compare(t1,t2){
console.log(parseTime(t1))
@vikasavnish
vikasavnish / index.py
Created June 29, 2018 11:36
flask_file_upload
from flask import Flask,render_template,jsonify,Response,json,url_for,request
import os
app = Flask(__name__)
UPLOAD_FOLDER=os.path.basename("uploads")
ALLOWED_EXTENSIONS = set(['csv'])
app.config['UPLOAD_FOLDER']=UPLOAD_FOLDER
def allowed_file(filename):
@vikasavnish
vikasavnish / .block
Created October 30, 2018 03:04
D3 study: line
license: mit
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
uuid_track=0
if (document.cookie.indexOf("uuid_set=")==-1){
uuid_track = uuidv4()
document.cookie = "uuid_set="+ uuid_track
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
uuid_track=0
if (document.cookie.indexOf("uuid_set=")==-1){
uuid_track = uuidv4()
document.cookie = "uuid_set="+ uuid_track