Skip to content

Instantly share code, notes, and snippets.

@sridharraman
sridharraman / game_to_api.js
Last active February 24, 2022 15:54
Game to API
// import html2canvas from 'html2canvas';
// on button click
document.querySelector("#btnShare").addEventListener("click", (e) => {
// convert #preamble to canvas
html2canvas(document.querySelector("#preamble"), {
useCORS: true,
allowTaint: true
}).then(canvas => {
@sridharraman
sridharraman / apiqueue.js
Created July 28, 2021 16:04
bee-queue issue with job result
const Queue = require('bee-queue');
const options = {
// isWorker: false,
sendEvents: false,
redis: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
password: process.env.DB_PASS,
},
@sridharraman
sridharraman / leaflet_polyline_marker.html
Created January 10, 2018 11:45
Extend leaflet.js marker to include polyline and display it like a toggling popup on clicking
<!DOCTYPE html>
<html>
<head>
<title>Quick Start - Leaflet</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
@sridharraman
sridharraman / change_permissions_script
Created March 3, 2014 10:27
Change permissions for folder and files recursively from the terminal
To change all the directories to 755 (-rwxr-xr-x):
find . -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find . -type f -exec chmod 644 {} \;
@sridharraman
sridharraman / tar-each-folder
Created May 22, 2013 10:25
Tar each folder separately into a separate archive
for dir in `ls`; do tar -cvzf ${dir}.tar.gz ${dir}; done
@sridharraman
sridharraman / gist:4491564
Last active December 10, 2015 20:58
Steps used to fix Calibre in OFFICE-LAPTOP
Problem:
Pressing Tab Key used to crash Calibre.
Solution:
1) sudo python -c "import urllib2; exec urllib2.urlopen('http://status.calibre-ebook.com/linux_installer').read(); main()"
2) Try uninstalling qt-at-spi or setting an environment variable to disable ACCESSIBILITY.
3) http://calibre-ebook.com/download_linux
* sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = import('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main()" -> WORKED
4) sudo add-apt-repository ppa:n-muench/calibre
@sridharraman
sridharraman / Clearing Recent
Created January 7, 2013 17:25
Clearing Recently Opened Files
From a terminal window:
$ cd ~/.local/share/
To clear history:
$ rm recently-used.xbel
$ touch recently-used.xbel
To disable history:
$ sudo chattr +i recently-used.xbel
@sridharraman
sridharraman / gist:3831908
Created October 4, 2012 06:57
SCP for large files
scp airtel@59.145.145.194:/home/airtel/data/airtel_archive.tar.gz . 2>&1
After entering password, press Ctrl+Z - process will be temporarily stopped.
Then run this command: bg