Skip to content

Instantly share code, notes, and snippets.

View thanhtunguet's full-sized avatar
🎯
Focusing

Thanh Tùng Phạm thanhtunguet

🎯
Focusing
View GitHub Profile
@thanhtunguet
thanhtunguet / scss-mock-generator.js
Created August 6, 2021 10:26
Generate SCSS mocks for Jest
const fs = require('fs');
const {join} = require('path');
function readDirAll(path, files = []) {
if (fs.lstatSync(path).isDirectory()) {
fs.readdirSync(path).forEach((entry) => {
if (entry !== '.' && entry !== '..') {
readDirAll(join(path, entry), files);
}
});
@thanhtunguet
thanhtunguet / auto-ovpn.sh
Last active October 17, 2022 21:13
Auto reconnect OpenVPN
#!/bin/bash
function getStatus () {
ifconfig | grep $1 && return 1
return 0
}
getStatus tun0
if [[ $? == 0 ]];
then
@thanhtunguet
thanhtunguet / sync.sh
Last active November 16, 2019 10:17
Git Sync
#!/bin/bash
function writeHR {
echo '---------------------'
}
function sync {
while read line
do
writeHR;
@thanhtunguet
thanhtunguet / sent-friend-requests.js
Last active August 3, 2023 04:09
Cancel all sent friend requests on Facebook
(() => {
const buttons = document.getElementsByClassName('_54k8 _52jg _56bs _26vk _2b4n _56bt');
Object.values(buttons)
.forEach((button) => button.click());
})();
const regist = function (code) {
$.ajax({
type: 'POST',
url: `/chon-mon-hoc/${code}/1/2`,
success: (a, b) => {
commit(code);
},
error: (a, b) => {
commit(code);
},
@thanhtunguet
thanhtunguet / rating.js
Last active December 29, 2018 18:49
Tự động đánh giá học phần
(() => {
let x = document.getElementsByTagName('input');
for (let i = 0; i < x.length; i++) {
if (x[i].value === "4") {
x[i].click();
}
}
let submit = document.getElementsByName('submit')[0];
submit.click();
})();