Skip to content

Instantly share code, notes, and snippets.

View artisandhq's full-sized avatar
🎯
Focusing

artisand artisandhq

🎯
Focusing
View GitHub Profile
@artisandhq
artisandhq / merge.md
Last active March 16, 2021 07:16
The best and safest way to merge branch in Git
git checkout master
git pull origin master
git merge test
git push origin master
@artisandhq
artisandhq / COMMAND.md
Last active March 17, 2021 01:24
Getting branches to same level as master git command

If you want to make to be the same as master

git checkout development
git reset --hard master
git push -u origin <local-branch-name>

Force your forked repo to be the same as upstream. Forces master changes into fork and throws away all changes! if no upstream remote created: git remote add upstream https://[upstream guy's repo url]

@artisandhq
artisandhq / pipreqs.md
Created April 6, 2021 06:20
How to automatically install required packages from a python script as necessary?

How to automatically install required packages from a python script as necessary?

Based on here

Let's assume that your Python script is example.py:

import os
import time
import sys
import fnmatch
@artisandhq
artisandhq / views.py
Created May 18, 2021 02:38
Django make aware datetime
d = datetime.datetime.now()
timezone = pytz.timezone("Asia/Taipei")
d_aware = timezone.localize(d)
@artisandhq
artisandhq / .gitignore
Created May 26, 2021 00:45 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@artisandhq
artisandhq / vue.config.js
Created June 8, 2021 06:18
Proxy Vue JS to server
module.exports = {
devServer: {
proxy: {
'^/api': {
target: 'http://localhost:8000',
changeOrigin: true,
secure: false,
pathRewrite: {
'^/api': '/api'
},
async function f() {
const fsPromises = require('fs').promises;
const data = await fsPromises.readFile('/tmp/data.json')
.catch((err) => console.error('Error: ', err));
return JSON.parse(data.toString());
}