Skip to content

Instantly share code, notes, and snippets.

View alirezahi's full-sized avatar
🏀
Happy to be Busy

Alireza Heydari alirezahi

🏀
Happy to be Busy
View GitHub Profile
find . -type f | sed 's_.*/__' | sort| uniq -d|
while read fileName
do
find $dirname -type f | grep "$fileName"
done
SELECT
tc.table_schema,
tc.constraint_name,
tc.table_name,
kcu.column_name,
ccu.table_schema AS foreign_table_schema,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
information_schema.table_constraints AS tc
# chrome releases: https://www.slimjet.com/chrome/google-chrome-old-version.php
sudo wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_75.0.3770.142-1_amd64.deb && \
sudo dpkg -i google-chrome-stable_75.0.3770.142-1_amd64.deb && \
sudo apt-mark hold google-chrome-stable && \
google-chrome-stable --version \
from datetime import datetime
from tinydb_serialization import Serializer
class DateTimeSerializer(Serializer):
OBJ_CLASS = datetime # The class this serializer handles
def encode(self, obj):
return obj.strftime('%Y-%m-%dT%H:%M:%S')
def decode(self, s):
return datetime.strptime(s, '%Y-%m-%dT%H:%M:%S')
@alirezahi
alirezahi / tor.sh
Last active February 16, 2020 19:18
sudo apt-get install tor
sudo service tor start
# check tor:
# curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs
pip install stem
pip install requests
pip install requests[socks]
pip install requests[security]
# if error on the above command:
@alirezahi
alirezahi / baywatch.js
Created February 4, 2020 08:07
Bulk Watch for Vue
export default {
methods: {
baywatch: function(props, watcher) {
const iterator = function(prop) {
this.$watch(prop, function(newVal, oldVal) {
watcher(newVal, oldVal, prop);
});
};
props.forEach(iterator, this);
},
# install chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
# install zsh
sudo apt-get install zsh curl git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# install yarn
{"lastUpload":"2020-01-18T08:30:44.149Z","extensionVersion":"v3.4.3"}
function duplicateCount(text){
return (text.toLowerCase().split('').sort().join('').match(/([^])\1+/g) || []).length;
}
fetchUserInfo() {
this.userInfo.init();
ajaxWithJWT({
url: `${serverUrls.crm}/api/v2/user-management/whoami/`,
})
.then(res => {
const { data } = res;
this.$store.commit('setUser', data);
this.$store.commit('setPanelConfig', data);
this.$store.commit(