Skip to content

Instantly share code, notes, and snippets.

View phanirithvij's full-sized avatar
😶‍🌫️
When you are free please let me know

Phani Rithvij phanirithvij

😶‍🌫️
When you are free please let me know
View GitHub Profile
@phanirithvij
phanirithvij / app.py
Created July 2, 2018 11:59 — forked from liulixiang1988/app.py
upload multiple files in Flask
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from werkzeug import secure_filename
# Initialize the Flask application
@phanirithvij
phanirithvij / webdev_online_resources.md
Created July 27, 2018 08:27 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@phanirithvij
phanirithvij / main.py
Created November 22, 2018 13:50
ShamefulBluevioletCoordinate created by phanirithvij - https://repl.it/@phanirithvij/ShamefulBluevioletCoordinate
import requests
img_URL = "https://res.cloudinary.com/rootworld/image/upload/v1542648184/luffycuteandstuff.jpg"
API_URL = """\
https://api.pinterest.com/v3/visual_search/flashlight/url/?\
url={img_URL}\
&x=0\
&y=0\
&w=1\
@phanirithvij
phanirithvij / main.py
Created November 22, 2018 13:51
ShamefulBluevioletCoordinate created by phanirithvij - https://repl.it/@phanirithvij/ShamefulBluevioletCoordinate
import requests
img_URL = "https://res.cloudinary.com/rootworld/image/upload/v1542648184/luffycuteandstuff.jpg"
API_URL = """\
https://api.pinterest.com/v3/visual_search/flashlight/url/?\
url={img_URL}\
&x=0\
&y=0\
&w=1\
@phanirithvij
phanirithvij / 3-1.py
Created December 3, 2018 16:56
Adventofcode D3-P1
import numpy as np #using numpy
empty = np.empty((1000,1000)) #empty grid
empty[:,:] = 0 #initializing the whole thing to zreoes
def get_input():
with open("input3-1.txt") as file: #input3-1.txt file contains the input
for data in file.read().split("\n"):
if data != "":
parser(data)
@phanirithvij
phanirithvij / main.dart
Last active November 9, 2019 15:08
A dart example to remove duplicate objects by a particular field
class Person{
final String name;
const Person(this.name);
toString(){
return "Person Object $name";
}
}
void main() {
final people = [Person("Joe"), Person("Mary"), Person("Mary")];
@phanirithvij
phanirithvij / main.dart
Last active December 16, 2019 08:23
A pageview example
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: PageviewDemo(),
)));
}
class PageviewDemo extends StatelessWidget {
@phanirithvij
phanirithvij / aes_encryption_helper.dart
Created December 28, 2019 12:52 — forked from proteye/aes_encryption_helper.dart
How to AES-256 (CBC/CFB mode) encrypt and decrypt in Dart/Flutter with Pointy Castle
import 'dart:convert';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "./convert_helper.dart";
// AES key size
const KEY_SIZE = 32; // 32 byte key for AES-256
const ITERATION_COUNT = 1000;
@phanirithvij
phanirithvij / Get-Client-Rect.ps1
Last active March 24, 2020 14:03
mpv js extension to save the last position, dimensions of the mpv windows. i.e. open same as before. Only WINDOWS
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Window {
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ClientToScreen(IntPtr hWnd, ref POINT lpPoint);
@phanirithvij
phanirithvij / zip.go
Created May 22, 2020 09:13
Gloang zip folder with progress
package main
import (
"archive/zip"
"errors"
"io"
"log"
"os"
"path/filepath"