Skip to content

Instantly share code, notes, and snippets.

View imvaskii's full-sized avatar
🎯
Focusing

Bhaskar imvaskii

🎯
Focusing
View GitHub Profile
@imvaskii
imvaskii / fileupload.py
Last active October 7, 2019 07:26
Python script to upload file using curl
def upload_file(self, file_path, upload_url):
"""
Upload file using curl
based on https://github.com/Lispython/pycurl/blob/master/examples/file_upload.py
:param file_path:
:param upload_url:
:return: abs file url path of uploaded file.
"""
if file_path is None or not os.path.exists(file_path):
print("File '{}' cant be uploaded".format(file_path))
@imvaskii
imvaskii / SimpleAuthServer.py
Created October 31, 2017 12:19 — forked from fxsjy/SimpleAuthServer.py
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@imvaskii
imvaskii / diskusage.sh
Created November 17, 2017 10:06
Disk usage on specific path/location -linux/unix
#!/bin/sh
# Default path is root (/)
path="/"
# if string is not null
if [ -n "$1" ]; then
path="$1"
fi
@imvaskii
imvaskii / safeurl_base64_decode.php
Created November 22, 2017 00:11
Decode a string with URL-safe Base64.
<?php
/**
* Decode a string with URL-safe Base64.
*
* @param string $input A Base64 encoded string
*
* @return string A decoded string
*/
public static function urlsafeB64Decode( $input ) {
$remainder = strlen( $input ) % 4;
@imvaskii
imvaskii / maybe_convert_arraykeys_lcfirst.php
Last active November 23, 2017 06:01
Converts first char of array keys to lowercase
<?php
/**
* Converts first char of array keys to lowercase
*
* @param $multd_array
*
* @return array
*/
function maybe_convert_arraykeys_lcfirst( $multd_array ) {
$result = [];
@imvaskii
imvaskii / docker-rm.sh
Created December 21, 2017 00:38
Remove docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@imvaskii
imvaskii / convert_post_label_to_article.php
Last active March 21, 2018 09:38
Rename posts label to "Articles"
<?php
// Alters post type labels.
add_action( 'registered_post_type', 'change_post_type_labels', 10, 2 );
// Posts menu label change to articles.
add_action( 'admin_menu', 'rename_post_menu_item_label' );
/**
* Replace Posts label to Articles in post edit admin page

Problem

In Arch Linux mkinitcpio -p linux

shows

Possibly missing firmware for module: aic94xx
 Possibly missing firmware for module: wd719x
@imvaskii
imvaskii / tmux.cheat
Created May 15, 2018 13:03 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@imvaskii
imvaskii / noip-dyndns-update.py
Last active December 30, 2024 12:09
A python (python3) script to update no-ip (https://www.noip.com) dynamic dns ip.
#!/usr/bin/env python
import requests, socket
username = ""
password = ""
hostname = "" # your domain name hosted in no-ip.com
# Gets the current public IP of the host machine.
myip = requests.get('http://api.ipify.org').text