Skip to content

Instantly share code, notes, and snippets.

@4rshdeep
4rshdeep / index.html
Created April 19, 2023 06:40
Yeti Login from Darin S
<form>
<div class="svgContainer">
<div>
<svg class="mySVG" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 200">
<defs>
<circle id="armMaskPath" cx="100" cy="100" r="100"/>
</defs>
<clipPath id="armMask">
<use xlink:href="#armMaskPath" overflow="visible"/>
</clipPath>
#https://pyttsx3.readthedocs.io/en/latest/engine.html#examples
import pyttsx3
engine = pyttsx3.init()
engine.setProperty('voice', 'punjabi')
rate = engine.getProperty('rate')
print(rate)
engine.setProperty('rate', rate-100)
engine.say('ਸੋ ਦਰੁ ਤੇਰਾ ਕੇਹਾ ਸੋ ਘਰੁ ਕੇਹਾ ਜਿਤੁ ਬਹਿ, ਸਰਬ ਸਮਾਲੇ ॥ ਵਾਜੇ ਤੇਰੇ ਨਾਦ ਅਨੇਕ, ਅਸੰਖਾ ਕੇਤੇ ਤੇਰੇ ਵਾਵਣਹਾਰੇ ॥ ਕੇਤੇ ਤੇਰੇ, ਰਾਗ ਪਰੀ ਸਿਉ ਕਹੀਅਹਿ ਕੇਤੇ ਤੇਰੇ ਗਾਵਣਹਾਰੇ ')
engine.runAndWait()

https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html In addition to labeling a directory as a Python package and defining __all__, __init__.py allows you to define any variable at the package level. Doing so is often convenient if a package defines something that will be imported frequently, in an API-like fashion. This pattern promotes adherence to the Pythonic "flat is better than nested" philosophy. An example

Here is an example from one of my projects, in which I frequently import a sessionmaker called Session to interact with my database. I wrote a "database" package with a few modules: ` database/ init.py schema.py insertions.py

@4rshdeep
4rshdeep / utils.md
Created January 18, 2018 16:44
utils.md

Use git config --global --unset http.proxy to unset proxy

  • Use git config --global http.proxy http://<userid>:<passwd>@proxy62.iitd.ac.in:3128
  • Added some files with a particular extension unknowingly do git rm -r '*.class' and then echo '*.class' >> .gitignore
  • scp file_location_on_local cs5160625@palasi.cse.iitd.ac.in:/location/to/directory
  • scp cs5160625@palasi.cse.iitd.ac.in:/home/dual/cs5160625/location ./ -- saves to pwd in local

And finally i found 100% work for me (check on two same laptops with different version Ubuntu 16.04LTS and 17.04)

  1. Open Terminal, enter iwconfig and note down the wl* number.
@4rshdeep
4rshdeep / avg.py
Created April 27, 2017 12:41
Want to get average of marks in any minor or a quiz just copy that data in a .txt file and then run the following program. And it somehow prints the average. Make sure that you have just one .txt file in the current directory
import os
#gets the files ending with .txt in the current directory
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
if f.endswith('.txt'):
filename = f
#opens the file
a = open( filename , 'r')
#lines contains list of lines in the file
lines = a.readlines()
@4rshdeep
4rshdeep / moodle_captcha
Created April 3, 2017 14:41
Open https://moodle.iitd.ac.in/login/index.php Copy paste the code in the console.
var field = document.getElementById('valuepkg3');
var condition = field.previousSibling.textContent;
var numbers = condition.match(/\d+/g).map(Number);
var myInt = 0;
if(condition.includes('first')){
myInt = numbers[0];
}
else if(condition.includes('add')){
myInt = numbers[0]+numbers[1];
}
@4rshdeep
4rshdeep / bootstrapCDN.html
Created March 1, 2017 13:39 — forked from planetoftheweb/bootstrapCDN.html
Bootstrap 3 CDN Page Code
<!-- HEAD SECTION -->
<!-- IE Edge Meta Tag -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">