Skip to content

Instantly share code, notes, and snippets.

View rana01645's full-sized avatar

Afjalur Rahman Rana rana01645

View GitHub Profile
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
<?php
namespace App\Acme;
use Carbon\Carbon;
// now, this class only gets the sales between the given dates.
// It doesn't deal with how with sales are stored, it doesn't
// deal with how to format the output, it doesn't deal with Auth
class SalesReporter
@rana01645
rana01645 / remove_comment_regex.txt
Created December 13, 2020 07:31 — forked from natebass/remove_comment_regex.txt
Remove comments from file. Credit to Lambda's answer on Stack Overflow https://stackoverflow.com/a/2613945/5178499
Remove all block comments and line comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*)
Remove block comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)
Remove line comments:
([ \t]*//.*)
@rana01645
rana01645 / wgcf.py
Created July 22, 2020 20:55 — forked from oskar456/wgcf.py
Cloudflare WARP linux client (using wg-quick for actual tunnel setup)
#!/usr/bin/env python3
import subprocess
import json
import os
from pathlib import Path
import requests
from requests.compat import urljoin
sudo mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
service mysql restart
@rana01645
rana01645 / background.js
Created November 16, 2019 21:27 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@rana01645
rana01645 / DpToPxAndPxToDp
Created September 14, 2019 03:12 — forked from laaptu/DpToPxAndPxToDp
Android convert dp to px and vice versa
public static float convertPixelsToDp(float px){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float dp = px / (metrics.densityDpi / 160f);
return Math.round(dp);
}
public static float convertDpToPixel(float dp){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return Math.round(px);
@rana01645
rana01645 / GoogleFonts.txt
Created July 28, 2019 06:58 — forked from karimnaaji/GoogleFonts.txt
Google fonts list (TTF)
{
"kind": "webfonts#webfontList",
"items": [
{
"kind": "webfonts#webfont",
"family": "ABeeZee",
"category": "sans-serif",
"variants": [
"regular",
"italic"