Saturday, May 25, 2024
AI tools for content creators
Monday, February 26, 2024
AI notes
Ollama provides a way to run AI models on your PC with around 16 GB ram. It is slow but it works. Need to try connecting with eGPU as my mac supports Thunderbolt 4.
Ollama AI
https://ollama.com/
ollama run llama2
Uncensored models
ollama run llama2-uncensored
ollama run nous-hermes-llama2
ollama run wizard-vicuna
ollama run codellama. //for java, python, c++ etc
ollama list
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway --name ollama-webui --restart always ghcr.io/ollama-webui/ollama-webui:main
ollama webui
- cd /Users/[]/AI/ollama-webui/backend
2. sh start.sh
Open chrome with debug port
cd /Applications/Google Chrome.app/Contents/MacOS
./Google\ Chrome --remote-debugging-port=9222
TextGen
Manual installation text generation webui using Conda
https://github.com/oobabooga/text-generation-webui
Recommended if you have some experience with the command-line.
0. Install Conda
https://docs.conda.io/en/latest/miniconda.html
On Linux or WSL, it can be automatically installed with these two commands (source):
curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh
1. Create a new conda environment
conda create -n textgen python=3.11
conda activate textgen
2. Install Pytorch
System | GPU | Command |
Linux/WSL | NVIDIA | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 |
Linux/WSL | CPU only | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu |
Linux | AMD | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6 |
MacOS + MPS | Any | pip3 install torch torchvision torchaudio |
Windows | NVIDIA | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 |
Windows | CPU only | pip3 install torch torchvision torchaudio |
The up-to-date commands can be found here: https://pytorch.org/get-started/locally/.
For NVIDIA, you may also need to manually install the CUDA runtime libraries:
conda install -y -c "nvidia/label/cuda-12.1.0" cuda-runtime
3. Install the web UI
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
pip install -r <requirements file according to table below>
Requirements file to use:
GPU | CPU | requirements file to use |
Apple | Intel | requirements_apple_intel.txt |
conda activate textgen
cd text-generation-webui
python server.py
Tuesday, April 19, 2022
Sanskrit slokas
1. The seeker
vidyA turAnAm na sukham na nidrA
arda turAnAm na bandhu na mitrA
kshudha turAnAm na ruchi na pakwam
kAmA turAnAm na bhayam na lazzA
Pursuit knows no comfort no sleep
Greed knows no relatives no friends
Hunger knows no taste no ripening
Desperation/lust know no fear no shame
Wednesday, February 23, 2022
Speed reading techniques
Did you know that most of us use only 4% to 10% of our mental abilities?
When you read, are you aware of an inner voice that follows the words as your eyes move across the page or the computer screen? This inner voice is called 'subvocalization'. You probably experience it as a slight movement in the tongue or throat region. As long as you subvocalize, you limit your reading to the speed of normal speech, to about 300 w.p.m.
The Mind is capable of thinking much faster than that. So when you subvocalize, you're literally holding back your mind. Try this exercise:
As you read, count to yourself, silently, from one to ten. Or, repeat the sound 'Eee', 'Eee', 'Eee'. It will be impossible to do this at the same time as subvocalizing, so this is an excellent way ofbreaking the habit of subvocalization.
As you do this exercise, you'll become aware that you're no longer processing the words in the tongue/throat region but in an area called 'thought stream' that you experience in the top of your head.
THOUGHT STREAM MOVES MUCH FASTER THAN SUBVOCALIZATION. AND THAT'S WHY PEOPLE WHO SUBVOCALIZE OFTEN HAVE COMPREHENSION PROBLEMS.
There's a mismatch between reading speed and thinking speed. The Mind is constantly racing ahead of the inner voice and so it gets bored. You experience this as an inability to hold your
attention on what you're reading. You have to back-skip words, or read the same line twice.
As your reading speed catches up with your thinking speed, reading becomes much less tiring and your comprehension improves.
2. Eye movements
Once you've got a feeling for reading in 'thought stream', the next thing to do is speed up your eye movements. This will also help break the habit of sub-vocalization, since your eyes will be movingfaster than you can possibly subvocalize.
Your eyes move across the written page in a series of quick jumps. Between each jump there's a stop lasting a fraction of second, called a 'fixation'. The fixation is when the eye actually takes in the written word.
The untrained eye takes about a quarter of a second at each fixation, and takes in 2 or 3 words per fixation.
By speeding up you eye movements, you'll learn to make fewer fixations per line and take in more words per fixation.
Try this exercise:
If you use a glass 'anti-glare' screen, draw 2 vertical lines in felt-tip, 5 cms apart, so that you have a strip 5 cms wide located over the middle of the text you are reading.
Now move your eyes in a 'Z' pattern down this central strip, at a speed faster slightly faster than is comfortable.
Because your Mind is not reading each word, it is forced to 'fill in the gaps'. This engages much more of the Mind, since it has to build associations and patterns in the written material. This in turn
This technique takes advantage of the fact that much of written English is highly redundant; a lot of words can be skipped without any loss of meaning.
When your eyes move down a central strip of the text, you also engage much more of your peripheral vision. And that in turn brings the right hemisphere of the brain into the reading process. You make much more use of the right-brain's ability to synthesize and build relationships within the material.
So speed reading is not just about reading faster; it also allows you to access much more of the brain and thereby increases your comprehension and creativity.
Some more on Incresing reading speed
In order to make our speed increase we must take in more words with each fixation, rather than make our eyes move faster.
1. Try to avoid focusing on every word, but rather look at groups of 2 to 3 words. For instance, this sentence could be grouped in this manner: for instance / this sentence / could be grouped / in this manner
2. Work on vocabulary improvement. Familiarize yourself with new words so you don't get stuck on them when you read them again.
3. If you find yourself moving your lips when reading, force yourself to read faster by following (1.) above so that you can no longer move your lips.
4. Read more! 15 minutes a day of reading an average size novel equals 18 books a year at an average reading speed!
5. Determine your purpose before reading. If you only need main ideas, then allow yourself to skim the material. Don't feel you must read very word.
6. Spend a few minutes a day reading at a faster than comfortable rate (about 2 to 3 times faster than your normal speed). Use your hand or an index card to guide your eyes down the page. Then time yourself reading a few pages at your normal speed. You'll find that often your normal reading speed will increase after your skimming practice.
7. If you have poor concentration when reading, practice reading for only 5 - 10 minutes at a time and gradually increase this time.
8. There are several books on increasing reading speed available in most bookstores. If you are serious about increasing your rate you may want to work systematically through one of these books.
Tuesday, February 15, 2022
Virtual box gotchas
Virtual box
- creates guest OS virtual machines on host operating system (the ones you use enerally)
By default the resolution of the guest OS will not be same as host os (your actual os). You will need to install Guest additions and switch to Seamless mode after the os is started.
Running VPN within virtual box :
https://windowsreport.com/vpn-not-working-on-virtualbox/
Open VPN in windows 10 virtual machine with DNS blocked on VPN gateway:
Context: The Open VPN server on company network was not supporting external DNS resolution . This was probably blocked by admin for security reasons. The suggested approach was to use dnsmasq which is supported only on mac /linux. But i was on windows 10, hence had to find an alternative. I tried Acryllic DNS proxy client. Basically AcryllicDNS does dns resolution on the local system.
1. Below is result of DNS resolution with Acryllic DNS running and open VPN off
c:> nslookup google.com 127.0.0.1
C:\Users\sandeep>nslookup google.com 127.0.0.1
Server: UnKnown
Address: 127.0.0.1
Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:4009:81d::200e
142.250.180.14
You see above the DNS got resolved using Acryllic DNS running on 127.0.0.1
2. Below is result of DNS resolution with Acryllic DNS running and open VPN running
c:> nslookup google.com 127.0.0.1
C:\Users\sandeep>nslookup google.com 127.0.0.1
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown Address: 127.0.0.1
DNS request timed out.
timeout was 2 seconds. ...
*** Request to UnKnown timed-out
As you see above the problem with DNS resolution when open VPN is on .
Note: By default DNS server of choice was picked from the open VPN ethernet adapter TAP. This can be switched to use localhost (127.0.0.1) by setting the metric on adapter (Adapter properties >> IpV4 >> Advanced settings >> metric = 5).
Basic commands
1. To list all the registered VMs: vboxmanage list vms
Network commands on windows :
1. ping -t google.com
2. tracert google.com [8.8.8.8] ([] is the DNS server to override)
3. route print ( After tracert we can run this to check the route you amazon packet took ;) )
4. ipconfig /displaydns [ /flushdns ]
Gotchas:
1. For fixing screen resize one needs to install guest additions plugin for virtual box. Sometimes it doesnt do anything on clicking Device >> Insert guest additions.
Fix : Insert Guest Additions simply inserts a CD. That's it. If your guest supports Autoplay and it is enabled, the installation will start. Otherwise you'll have to start the installation manually. More details on the user manual, ch. 4.2.
Ref: https://forums.virtualbox.org/viewtopic.php?t=86281
2. Coming out of scaled mode : hit right CTRL + C , right CTRL +L to come out of seamless mode
3. Guest doesnt resolve dns when open vpn is connected
VBoxManage modifyvm "<VM name>" --natdnshostresolver1 on
As a result, guest OS DNS requests will be intercepted and resolved using host DNS API, rather than having guest OS connect to external DNS servers as with --natdnsproxy1 on
.
Ref: https://superuser.com/questions/641933/how-to-get-virtualbox-vms-to-use-hosts-dns
4. Connecting from mac Guest OS to windows host os (as guest additions was not working):
1.Shared the windows folder (right click folder >> properties >> share)
2. ON virtual box VM config, add another adapter 2 called Bridged adapter. This will create a bridged network adapter for which you fix a static ip say 192.168.1.100.
3. From Mac Guest open Finder (icon in the panel) >> Click Go menu >> Connect to server. Enter Ip 192.168.1.100. Thats it shared folder appears.
Refer link
References :
- VBoxManage commands : https://blog.scottlowe.org/2016/11/10/intro-to-vbox-cli/
Wednesday, July 28, 2021
Trading in Indian stock market for dummies
I dedicated almost an year on studying stock market practically and later automating it with python using Zerodha API, will refine my ideas here for others to get a jump start.
Here we go ...Broadly there are 2 ways of trading(excluding commodities for simplicity)
1. Equity
Shares are created by companies when they go public via IPO(initial public offering). These prices move mainly based on company performance(Quarterly results), new deals signed , government policies (budget, eg: privatisation of banks ), market sentiment (Carona wave, petrol price), US markets.
Strategies
- Check US market to see the condition of market as US market is ~12 hours behind IST. Expect Indian market to move in unison with USA unless there is no major local market conditions.
- During July many companies have quarterly results, the markets tend to go down.
- Check for earnings release of company Money control earnings and buy if:
1. Previous quarterly earnings was profitable. Yearly earnings is profitable.
2. Market is not a bear market.
Sell when you make 5-10% profit (dont get greedy) as the wave normalizes in 2 days from date of result.
MIS trading
- The intraday trading(MIS) was never profitable except few hits. I made mistakes trading after 12pm while the intraday will close by 3.15 pm. Big mistake. MIS seems lucarative as the trading company(Zerodha in my case) gives around 6 times the leverage (1 day loan) if you are low on funds.
Better strategy for MIS is to Buy stock instead of Sell and combine with CNC normal. As we cant convert the sell position to long CNC) in case the trade goes wrong.
- For picking stocks : -William %R and bollinger band indicator combined with RSI showed good results on back testing (around 8% return per month) . These are good options for short term trading ( 1 week). Also you can consider supertrend which indicates .
2. Futures and options
These are just contracts created by trading agent eg : Zerodha deriving value from the actual stock or indices . For options put and call is used and purchased using premium price, during expiry the profit and loss on the derived stock is considered. Futures they are like equities but are contracts in future based without delivery and they have a monthy expiry. The weekly contracts end on thursday every week, also there are monthly contracts which end last thursday of the month.
- We trade on momentum of the stock derivative
- Super trend indicator is best.
- The Options contract premium near to the derived stock has huge movements (sometimes 100% movement) and are highly risky if you dont know how to do.
Gotchas:
1. Never trade by applying your emotions and with a fickle mind, always be rule and data driven.
2. Dont trade on MIS (margin intra day) after say 1pm. Convert position from MIS to CNC(Normal long) position for buy trades to avoid losses.
3. For Options contract never trade on contract expiring 2 days before. You loose the cushion of time incase the market swings in the opposite direction of your trade.
Sunday, March 29, 2020
Corona virus - immunity, treatment options / research
--------------------
1. Develop Immunity :
Pranayama - anulom vilom, brastrika, kapal bhati
Food : vitamin c rich food like lemon juice, amla juice
Medicine : swarna bhasma mixed with honey thoroughly, take 2 drops a day
Spiritual/scalar: meditation, omm mantra chant, shank blow, for nitic oxide production
Baba ramdev suggestion for carona
https://youtu.be/lLP3rgliqG8
2. Treatment:
Medicine : swarna bhasma mixed with honey thoroughly and consumed
Hydrochloroquine? Untested but been recommended as emergency.
3. Prevention :
Social distance, quarantine etc
4. Learn :
1. It has been told the spike protein of virus binds to the cell receptors before injecting its DNA or RNA? into the cell to replicate.
2. Baba ramdev suggestion for carona
https://youtu.be/lLP3rgliqG8
http://ajitvadakayil.blogspot.com/2020/02/coronavirus-deaths-nano-gold-colloids.html?m=1
Why not we as enterpreuners start building/distributing/collaborate for which will help fight carona virus in my opinion. eg :
1. Patient healthcare:
Mobile app+IOT based portable ventilators using arduino for patients. Eg:
https://youtu.be/IgAR4yWDsg0
2. Prevention/sterilization
- Masks - n95 grade
- Ozone/UV/gas based sanitizers
- UV/ozone sterilization booths for say supermarkets/ ATM/enclosed areas
Eg: https://youtu.be/SqytOuYfsnA
3. Virus testing kit (mobile app based with otg component?? )
5. Vaccine development accelerate
7. IOT virus sensors to detect potential threats??
8. Marketing and distribution of above.
My proprietary builds mobile and web based solutions for small business.. if i can have IOT collaboration, can create useful products.
https://twitter.com/ajeetbharath/status/1242294128211197955
Sunday, July 28, 2019
Constructing house DIY for dummies
Steps of house construction (Mysuru, Karnataka) for 30 x 40 plot with costs for reference
1. Paper work:
- Approval from Urban development authority of sanction plan (this is for approval only showing the space from compound to house etc)
- Sanction plan cost for 2 floors Rs. 2,500 . done in 2 days
- Government fee for approval : Rs.21,000. Done in 2 weeks
- Working plan Rs. 2500. Done in 3-4 days (ensure you spend more time on this as it is realized and cant change after starting)
- Structural design plan (showing the columns position, plinth beam details) Rs.7000
- KEB electricity approval can be done after sanction plan approval.. Rs.6000 for 1kw
2. Dig borewell before starting any work.
3. Foundation
Gotchas: The sump dug was too small and we ended up manual digging. Make sure you consider atleast 9 x 6 x 6 feet sump for storing 9,000 litres of water. The sump dug should be 2 feet more than what you want to build that is 11 x 8 x 7 feet so after laying bricks it will be as required
Cost breakup: Rs.550
JCB hired at Rs.750/hour x 5 hours = 3750
Tractor hired for dumping mud from JCB = 1800
2. Footing -
a. Prepare : Before column footing is filled with 1.6 feet of concrete it should be prepared with 6 inches of concrete using 40mm jelli (big sized) and cement.
b. Bar bending for column and mat for footing: 4 feet square mat is laid below as per column size given in structural design the TMT bar diameter is selected like 12mm, 16mm. The column using TMT bar is 20 feet high.
b. Footing concrete is added for upto 1.6 feet with concrete. The grade of concrete we selected was M15 for footing (1: 2 :4 bandli of cement: msand: jelli or 1 bag :4 bandli: 8 bandli of ratio). Refer. Less than 25 litres of water should be used per bag of cement. Better to use a concrete mixing machine.
Cost breakup:
1. TMT rods SK super at Rs. 47 /kg . For 820kg I paid Rs. 39,000.
2. 70 bags of ACC cement at Rs.380/bag = Rs. 26600
3. msand double wash : Rs. 20,000
4. Jelli 20mm : Rs. 11000
3. Footing column
a. Prepare: Alway good to keep the plinth lower level 2 feet above the road (as roads will become taller over time and we can avoid rain water seepage etc). Using a water pipe the tube level is used to raise all the footing columns to plinth level. (note : plinth is normally 3 feet above the footing concrete bed but varies as per rise we want for house above the road).
Note: Plinth is basically a 2 feet hight concrete cement structure above the size stone coarse which becomes the base of all the walls being raised.
b. Concrete column : ratio of 1:6:4 (cement : sand: gravel 20mm) was used for column building of footing column.
4. Digging is done by laying of size stone below the plinth beam. This is done using the plinth diagram provided by the structural design team.
Tuesday, May 8, 2018
Polymer
Pre-requisites
--------------
npm install -g bower
npm install -g polymer-cli
Quick start
-----------
mkdir my-app
cd my-app
1. Create skeleton project
polymer init
//Press the down arrow until polymer-2-starter-kit is highlighted and press the enter / return key to select.
2. Run from the folder created
polymer serve --open
3. Run tests
polymer test --open
Next steps:
----------
1. add element
bower install --save PolymerElements/paper-checkbox
Polymer video: https://skillsmatter.com/skillscasts/5743-introduction-to-building-polymer-web-components
HTML5 video tag:
1. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video
2. Open video tag : (set chrome inspector >> settings >> Elements >> show shadow DOM
3. Components made of :
HTML templates - the html that defines the web component eg: HTML for video tag
Custome elements - The things that gets injected into the shadow DOM
Shadow DOM
HTML imports
4. Anatomy of a web component:
//html here
5. Without Polymer also we can create above components
var sr=DOMelement.createShadowRoot();
sr.AC(doc.QS("#template")).content.cloneNode(true);
6. Polymer - API written by google to create shadow DOM web components.
Includes pre-written web components.
Browser support is limited but provides polyfills for older browsers
Polyfills
Provides things mentioned in point 3.
HTML templates - the html that defines the web component eg: HTML for video tag
Custome elements - The things that gets injected into the shadow DOM
Shadow DOM
Model driven views
Web animations
Pointer events
PPT: http://slides.com/bobbijvoet/redux-polymer-8#/26
Thursday, April 19, 2018
Cassandra
Key notes
----------
Session replication on database
Nodes/Zones
ACID
C - Consistency.. Cassandra provides eventual consistency
A - Availability
P - Partitioning ...processing can continue in the face
CQL - Cassandra query language
Let’s start with a short survey of some of the key concepts of Cassandra:
Cluster – a collection of nodes or Data Centers arranged in a ring architecture. A name must be assigned to every cluster, which will subsequently be used by the participating nodes
Keyspace – If you are coming from a relational database, then the schema is the respective keyspace in Cassandra. The keyspace is the outermost container for data in Cassandra. The main attributes to set per keyspace are the Replication Factor, the Replica Placement Strategy and the Column Families
Column Family – Column Families in Cassandra are like tables in Relational Databases. Each Column Family contains a collection of rows which are represented by a Map
Column – A column in Cassandra is a data structure which contains a column name, a value and a timestamp. The columns and the number of columns in each row may vary in contrast with a relational database where data are well structured
commands:
desc keyspaces
use demo
desc tables
desc department;
Friday, February 16, 2018
Nederlandse vocabulaire
- Goede[morgen/middag/avond] --> Good morning/afternoon/evening
- ("KHOO duh MORE khen") ("KHOO duh midakh") ("KHOO dun AH fohnt")
Directions :
- Noord Zuid Oost West --> north south east west
- hallo("HAH low"), hoi("hoy") --> hi
- doei, tot ziens --> bye ,see you
- ("dooey" or "dookh") ("toht zeens")
- dank je --> thank you
- Bedankt ("buh DAHNKT")—Thanks
- Meneer ("muh NEAR")—Mister
- Mevrouw ("muh FROW")—Miss, Mrs.
- Alstublieft ("ALST oo bleeft")—Please or if you please (formal)
Dutch poetry:
http://4umi.com/marsman/herinnering
Vocabolario Italiano
Buonasera --> Good evening
tuttala vitta, va bene --> alright
ciao --> Hello,hi
addio --> bye
tutto bene --> everything good
tutto a posto --> it's all OK
a posto is in place
si --> yes
va bene allora --> alright then
yes, ok is va bene --> yes, ok is fine
bravo --> good (it could be good guy, but also able guy)
ci vediamo domani --> see you tomorrow
il domani non muore mai --> tomorrow never dies
buon compleanno --> Happy birthday
contento --> Happy
Monday, November 13, 2017
GIT cheatsheet
- always pulls from master
2. Branch create/switch/download
git checkout
- IE_Migration
git checkout -b
git checkout [file name]
Branches are created under the current branch (default master)
Master <--> Dev Common Branch-->
|
----> Dev1 Branch
3. Pushing
git push origin [branch name]
-u upstream
Note: so we are sure we are comitting on the right branch
***Always pass origin and [branch name] to be sure you are pushing on the right branch ****
4. git status
- status of local repo
5. Comitting specific files
git add [file name with complete path]
git commit -m "commit text"
6. git branch // to view all the branches
7. Pull and fetch
git pull // pull the files and automerege
git fetch // doesnt do automerge
8. Merging
MasterBranch ---> DevBranch
git checkout Dev
git pull // to update on the branch
git checkout MasterBranch
git pull
git merge DevBranch
9. Ways for merging
1. create seperate branch per functionality
2. Tagging
git tag -v 1.0.0 [tagName]
3. Milestone
10. git reset -hard //to get everything from server. all local changes will be gone.
11. Reset branch as remote git fetch --prune git reset --hard @{upstream} git clean -d --force 12. Branch : team/cotr git add . git commit -m “DD-17384:Added extra parameter” git push origin HEAD:refs/for/team/cotr git commit --amend --no-edit git log -p -2
Other
Git rebase
Tuesday, September 19, 2017
Guide for staying working in netherlands/ amsterdam for Indians
The train and bus network is one of the best but expensive if you dont know how to make best use of the options available. I herewith make my best effort to help you getting around and accommodation search esp. in Amsterdam.
1. Travel
- Bus is the widely used mode of travel by expats and with highest connectivity. There are various companies who run the service like GVB, Connexxion and EBS.
- Metro is available in Amsterdam which connects majority of the places. Tram also go through some of these metro lines.
- Train is of two types. The super fast Intercity and super slow Sprinter. Link
- Bike/ Cycle. The cycle lane is all around the country and people enjoy cycling even in a Suit.
Useful websites
- https://www.onlyexpats.nl
- https://www.expatriates.com/
- https://www.pararius.nl (Dutch)
- Facebook groups like Indians in Amstelveen, Indians renting shared flat in Amsterdam/Amstelveen/. Very useful for short term room search.
- http://airbnb.com is for B& B but always be careful it might get cancelled anytime.
Taxes are very high in NL around (20-52%). Most of the working professionals fall under the 35% tax bracket. So for expats there is a 30% ruling option
30% ruling : Basically 30% of your gross salary will not be taxed.
Eg: You earn Euro 5000 per month gross. then you pay tax for 70% of your earning that is Euro 3500. 30% of it or Euro 1500 is without tax. So total you earn is (say at 35% tax slab) Euro 3775.
The tax slab depends on how much you earn in a year (like India tax system with tax slabs and range between 20-52%).
Useful tax link
6. Visa
HSM visa is required for working non-european nationals eg: Indians
Schengan visa for tourists to travel around Europe. Link