This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (ctx) => { | |
if (process.env.NODE_ENV !== 'production') return | |
const i = '<CLIENT_KEY>' | |
const s = 'https://www.goftino.com/widget/' + i | |
const l = window.localStorage.getItem('goftino_' + i) | |
const g = document.createElement('script') | |
g.async = true | |
g.src = l ? s + '?o=' + l : s | |
document.getElementsByTagName('head')[0].appendChild(g) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function IranLocale () { | |
const weekdays = 'یک\u200Cشنبه_دوشنبه_سه\u200Cشنبه_چهارشنبه_پنج\u200Cشنبه_جمعه_شنبه'.split('_') | |
const weekdaysAbbr = 'ی_د_س_چ_پ_ج_ش'.split('_') | |
const monthNames = ('فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند').split('_') | |
const monthNamesAbbr = 'فرو_ارد_خرد_تیر_مرد_شهر_مهر_آبا_آذر_دی_بهم_اسف'.split('_') | |
const intlDate = new Intl.DateTimeFormat('en-US', { | |
hour12: false, | |
calendar: 'persian', | |
numberingSystem: 'arabext', | |
year: 'numeric', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i --save-dev vue-template-compiler@2.6.14 vue-template-es2015-compiler@1.9.1 svgo@2.8.0 | |
const fs = require('fs') | |
const svgo = require('svgo') | |
const transpile = require('vue-template-es2015-compiler') | |
const compiler = require('vue-template-compiler') | |
async function compileSvg (source, id) { | |
source = compiler.compile(source, { preserveWhitespace: false }).render | |
source = `module.exports = { render: function () { ${source} } };` | |
return transpile(source).replace('module.exports =', 'export default') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div :class="classes" :style="styles"> | |
<img :src="imgsrc"> | |
</div> | |
</template> | |
<script> | |
export default { | |
props: { | |
width: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
# Setup CSGO Server | |
# | |
# os: ubuntu 20.04 | |
## | |
HOSTNAME="csgo.meyti.ir" | |
ADMINPASS="adminpass" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeConverter(ts){ | |
var a = new Date(ts * 1000); | |
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var date = a.getDate(); | |
var hour = a.getHours(); | |
var min = a.getMinutes(); | |
var sec = a.getSeconds(); | |
var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup: | |
# nano ~/.conf/systemd/user/chrome.service | |
# systemctl --user daemon-reload | |
# systemctl --user start chrome | |
[Unit] | |
Description=Google Chrome | |
Wants=display-manager.service | |
After=display-manager.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# play v2m in selected directory | |
xfce4-terminal --hold -e "bash -c 'cd %f; for i in *.v2m; do /opt/v2mplayer/v2mplayer \"\$i\" ;done'" | |
# play selected v2m file | |
xfce4-terminal -e "/opt/v2mplayer/v2mplayer %f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Watch active postgres connections and client processes info (name, pid, cmdline) | |
Note: postgres server and clients must be in same machine. | |
https://gist.github.com/meyt | |
requirements: | |
- psycopg2 >= 2.8.5 | |
- psutil >= 5.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from sqlalchemy import event | |
class sqlog: | |
def __init__(self, session_or_engine): | |
self.engine = ( | |
session_or_engine.get_bind() | |
if hasattr(session_or_engine, "get_bind") | |
else session_or_engine | |
) |