Skip to content

Instantly share code, notes, and snippets.

View codeeshop-oc's full-sized avatar
🎯
Focusing

Anant Negi codeeshop-oc

🎯
Focusing
View GitHub Profile
@codeeshop-oc
codeeshop-oc / select_multiple_tables_in_adminer_php_using_javascript.js
Created May 3, 2024 15:38
Select multiple tables in adminer.php using javascript
/*
Blog - https://codeeshop.medium.com/how-to-select-multiple-tables-in-adminer-php-using-javascript-dcdb0eb3bf44
Youtube Video - https://youtu.be/yF3WIENZVOY
*/
if ($('#jquerycdn') == null || !$('#jquerycdn').length) {
var s = document.createElement("script");
s.type = "text/javascript";
s.id = "jquerycdn";
s.src = "https://code.jquery.com/jquery-2.2.4.min.js";
@codeeshop-oc
codeeshop-oc / get_randomd_dates.js
Created May 1, 2024 11:37
Get Random Dates for number of times in format YYYY-MM-DD HH:MM:SS from last two years
function getRandomDates(numDates) {
const twoYearsAgo = new Date();
twoYearsAgo.setFullYear(twoYearsAgo.getFullYear() - 2);
const today = new Date();
const dates = [];
for (let i = 0; i < numDates; i++) {
// Get random milliseconds between two years ago and today
const randomTime = twoYearsAgo.getTime() + Math.random() * (today.getTime() - twoYearsAgo.getTime());
const randomDate = new Date(randomTime);
@codeeshop-oc
codeeshop-oc / opencart-seller-select-checkboxes-for-v2-v3-v4-Cloud.js
Created October 27, 2023 07:12
opencart-seller-select-checkboxes-for-v2-v3-v4-Cloud.js
const elems = document.querySelectorAll('#download-row0 [type="checkbox"]')
for (let i = 0; i < elems.length; i++) {
if (elems[i].checked) {
elems[i].click()
}
console.log(elems[i].parentElement.innerText)
const value = elems[i].parentElement.innerText
const trim_value = value.substr(0,2)
if(!['1.'].includes(trim_value)) {
@codeeshop-oc
codeeshop-oc / ffmpeg-remove-audio.txt
Created March 6, 2023 08:25
ffmpeg remove audio
ffmpeg -i TO_CONVERT_FILE -c copy -an TO_NEW_BUILD_FILE
@codeeshop-oc
codeeshop-oc / ffmpeg-all-corners-alternative-2s.txt
Last active March 6, 2023 08:17
ffmpeg all corners alternative 2s
ffmpeg -i TO_CONVERT_VIDEO_FILE -i /home/anantnegi/Videos/logo_60.png -filter_complex \
"[0:v][1:v]overlay=15:15:enable='if(between(mod(t,10),0,2),8)'[top-left]; \
[top-left][1:v]overlay=main_w-overlay_w-15:main_h-overlay_h-15:enable='if(between(mod(t,10),2,4),8)'[bottom-right]; \
[bottom-right][1:v]overlay=main_w-overlay_w-15:15:enable='if(between(mod(t,10),4,6),8)'[top-right]; \
[top-right][1:v]overlay=15:main_h-overlay_h-15:enable='if(between(mod(t,10),6,8),8)'[bottom-left]" -map "[bottom-left]" NEW_VIDEO_FILE_BUILD_FILE -y
@codeeshop-oc
codeeshop-oc / worflow_delete.sh
Last active January 26, 2023 11:04
Delete All Workflows Using Shell Script
read -p "Enter your [Branch/repo]: " branch_repo
branch_repo=${branchrepo:-"DEFAULT_REPO_NAME"}
# To Get workflow IDs with status "disabled_manually" add | contains("disabled_manually")
workflow_ids=($(gh api repos/$branch_repo/actions/workflows | jq '.workflows[] | select(.["state"]) | .id'))
for workflow_id in "${workflow_ids[@]}"
do
echo "Listing runs for the workflow ID $workflow_id"
run_ids=( $(gh api repos/$branch_repo/actions/workflows/$workflow_id/runs --paginate | jq '.workflow_runs[].id') )
@codeeshop-oc
codeeshop-oc / top_github_users_in_india_formatting_data.js
Created January 20, 2023 10:30
Formatted Data for top github users in india
// January 20, 2023
const datas = {
"data": {
"search": {
"userCount": 245,
"pageInfo": {
"endCursor": "Y3Vyc29yOjUw",
"hasNextPage": true
},
@codeeshop-oc
codeeshop-oc / Set_Start_and_End_Date_Based_on_Number_of_days.js
Created November 8, 2022 08:03
Set Start and End Date Based on Number of days
let getDateInFormat = function (dated) {
let dd = String(dated.getDate()).padStart(2, '0');
let mm = String(dated.getMonth() + 1).padStart(2, '0'); //January is 0!
let yyyy = dated.getFullYear();
return dated = yyyy + '-' + mm + '-' + dd;
}
let addDays = function (date, addDays) {
@codeeshop-oc
codeeshop-oc / is-rtl-text-test.js
Last active October 13, 2022 09:11
RTL Text Test
const isRtlText = require('is-rtl-text')
const Texts = ['کھ', '#sssssss w مهسا_امینی', 'A @@#', 'تھ', 'العربية', '𐬨𐬀𐬰𐬛𐬂']
for (let i = Texts.length - 1; i >= 0; i--) {
console.log(isRtlText(Texts[i]), Texts[i], 'Texts[i]')
}
@codeeshop-oc
codeeshop-oc / console.js
Last active August 19, 2022 13:07
Delete Google Chrome History by Selecting Mulitple List
// Goto Chrome History - chrome://history/
// Open and Run this in console
document.querySelector('history-app').$.history.selectAllItems()
document.querySelector('history-app').$.history.deleteSelected_()