Skip to content

Instantly share code, notes, and snippets.

https://beebom.com/how-flush-dns-cache-linux/
https://www.natro.com/blog/dns-onbellegi-temizleme/
@cozingo
cozingo / git-bash
Last active April 25, 2020 08:04
git branch in bash
# Display git branch in bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[git:\1]/'
}
files_count(){
/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g'
}
topshellv.com
@cozingo
cozingo / gist:f1aae81efeaabebe5bfc7859e84dae90
Created November 3, 2019 12:12
intercept and modify XHR request and response
https://github.com/jpillora/xhook
@cozingo
cozingo / vue-deep.scss
Created October 21, 2019 13:40
vue css deep
.parent-class {
& /deep/ .child-class {
background-color: #000;
}
}
@cozingo
cozingo / customizer
Last active October 10, 2019 12:55
Vue tdd
function customizer(objValue, srcValue) {
if (Array.isArray(srcValue)) {
return srcValue
}
if (srcValue instanceof Object && Object.keys(srcValue).length === 0) {
return srcValue
}
}
@cozingo
cozingo / zip.sh
Last active September 19, 2019 11:34
Zip exclude some folders
Exclude .git file and node_modules directory
zip -r9 [target_file] [source_file] -x *.git* node_modules/\*
Exclude .git file and files in node_modules directory, but keep node_modules directory
$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@cozingo
cozingo / git-fetch-file-from-commit
Created August 7, 2019 08:47
Git: checkout a single file from a specific commit
git checkout <COMMIT#> <path/to/the/messed/up/file>
Example:
git checkout f08a63ff4fa7b8479f8c698e5998ee1afcac3a4e src/assets/images/file.svg
@cozingo
cozingo / sed.txt
Created June 26, 2019 10:20
sed, find and replace
sed -i 's/original/new/g' file.txt
Explanation:
sed = Stream EDitor
-i = in-place (i.e. save back to the original file)
The command string:
s = the substitute command
original = a regular expression describing the word to replace (or just the word itself)
new = the text to replace it with
@cozingo
cozingo / git-delete.txt
Created June 20, 2019 05:26
git delete branch
local branch: git branch -d [branch]
remote branch: git push origin --delete [branch]