This file contains hidden or 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
//Git Mergetool and difftool with Beyond Compare 4 | |
//Install command line tools | |
//For osx | |
//IF running this command in git bash then escape $ with \ | |
git config --global diff.tool bcomp | |
git config --global difftool.bcomp.cmd "\"bcomp\" \"\$LOCAL\" \"\$REMOTE\"" | |
git config --global difftool.prompt false | |
git config --global merge.tool bcomp | |
git config --global mergetool.bcomp.cmd "\"bcomp\" \"\$LOCAL\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\"" |
This file contains hidden or 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
# ref: https://stackoverflow.com/questions/30331504/how-to-sort-a-json-file-by-keys-and-values-of-those-keys-in-jq | |
[ | |
{ | |
"Date": "2011-04-01", | |
"AnswerCount": "3913" | |
}, | |
{ | |
"Date": "2010-04-02", | |
"AnswerCount": "2995" |
This file contains hidden or 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 | |
# ref:https://zzz.buzz/2016/07/30/bom-in-iconv/ | |
# ref:https://stackoverflow.com/questions/16890582/unixmerge-multiple-csv-files-with-same-header-by-keeping-the-header-of-the-firs | |
for filename in *.csv; do | |
sed -i 's/\xef\xbb\xbf//' $filename | |
done | |
awk 'FNR==1 && NR!=1{next;}{print}' *.csv > merge-bom.csv |
This file contains hidden or 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
# ref: https://devblogs.microsoft.com/scripting/save-a-microsoft-excel-workbook-as-a-pdf-file-by-using-powershell/ | |
# run as administrator priviledge | |
$path = Get-Location | |
$xlFixedFormat = "Microsoft.Office.Interop.Excel.xlFixedFormatType" -as [type] | |
$excelFiles = Get-ChildItem -Path $path -include *.xls, *.xlsx -recurse | |
$objExcel = New-Object -ComObject excel.application | |
$objExcel.visible = $false | |
foreach($wb in $excelFiles) | |
{ |
This file contains hidden or 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
from io import StringIO | |
with open('MA.html', 'r') as f: | |
sio = StringIO(f.read()) | |
dfs = pd.read_html(sio) |
This file contains hidden or 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
$ tmux attach | |
protocol version mismatch (client 7, server 6) | |
$ pgrep tmux | |
3429 | |
$ /proc/3429/exe attach |
This file contains hidden or 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
{"version":1,"resource":"file:///Users/seathief/PycharmProjects/BLI_chat/.gitignore","entries":[{"id":"7fAf","source":"textFileCreate.source","timestamp":1663048101895},{"id":"R18z","source":"Workspace Edit","timestamp":1663048120735},{"id":"vnpN","source":"Workspace Edit","timestamp":1663048163028},{"id":"ATfx","source":"Workspace Edit","timestamp":1663048173732},{"id":"Wuy5","timestamp":1663048178393},{"id":"YsQ2","source":"Workspace Edit","timestamp":1663048198006},{"id":"pzt9","source":"Workspace Edit","timestamp":1663048214825},{"id":"jAyu","source":"Workspace Edit","timestamp":1663048229396},{"id":"6byA","timestamp":1663048237174},{"id":"9ZLb","source":"Workspace Edit","timestamp":1663048253163},{"id":"CSUd","timestamp":1663048262734},{"id":"V20c","source":"Workspace Edit","timestamp":1663048269486},{"id":"Qin7","source":"Workspace Edit","timestamp":1663048298047}]} |
This file contains hidden or 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
# html | |
<input type="text" class="form-control" id="appName1" | |
data-sync="input" data-target="#appName2"> | |
# javascript | |
$("[data-sync='input']").blur(function(){ | |
$($(this).data('target')).val($(this).val()); | |
}); |
This file contains hidden or 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 | |
sudo mount -o remount,size=10G,noatime /tmp | |
echo "Done. Please use 'df -h' to make sure folder size is increased." |
This file contains hidden or 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 string | |
import random | |
def idno_generator(): | |
''' | |
credit goes to | |
https://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python | |
''' | |
return random.choice(string.ascii_uppercase) + ''.join(random.choice(string.digits) for _ in range(10)) |
NewerOlder