Tumgik
#git grep
abalidoth · 1 year
Text
> git clone https://standard.gender/girl.git
> cd girl
> git checkout -b tesseract_gender
> rm pronouns/she.pn
> cp ~/they.pn pronouns/they.pn
> cp ~/ae.pn pronouns/ae.pn
> mkdir robot
> mkdir math
> mkdir other
> cd other
> echo "TODO: dragons????" > README.md
> cd ..
> echo "TODO: clean unwanted bloat out of /gender_roles, grep everything for 'woman' and get rid of it, figure out a way to stop the import errors when I use the beard module" >> README.md
> git add .
> git commit -m "Work in progress! Also, future Tessa: make this a fork and don't just leave it a branch forever like you KNOW we will."
77 notes · View notes
vizthedatum · 11 days
Text
I think in parentheticals (and I write like that too)
In the garden of my mind, thoughts bloom wild and free, a tapestry of code and art, a symphony of me. (Brushstrokes of no-thoughts femboy Bengali dreams) Neurons fire in patterns, complex beyond compare, as I navigate this life with logic and flair. {My mind: a codebase of evolving truths} [Data points scatter, t-tests confuse] --Sensory overload interrupts my stream of-- /*TO-DO!!! Refactor life for optimal growth*/ |grep for joy| |in life's terminal|
A canvas of brackets, ideas intertwine, functions and objects, in chaos align. /*FIX ME!!!!!!! Catch exceptions thrown by society*/ |stdout of trauma| |stdin of healing| Confidence intervals stretch far and wide, as গোলাপ্রী blooms, with so many colors inside. {Functions intertwined? Objects undefined?} [Omg, what if logistic regression predicts my fate?] I am able to visualize the complexity within, as p-values in my field irritate me from under my skin. (Artistic visions lazily swirl with wanton scientific precision) --consciousness, a synesthesia of ideas--
{while(true) { explore(self); } // Infinite loop} In loops infinite, I explore lessons of my soul; all your null hypotheses rejected! Hah, I'm extraordinary and whole. /*I DARE YOU: Try to do five weeks of work in one morning*/ [Is it valid to try to see if ANOVA reveals the variance of me?] (A canvas of brackets, a masterpiece of neurodiversity) Opening tags of 'they', closing with 'he', in this markup of life, I'm finally free.
--tasting colors of code, hearing shapes of data-- /*NOTE TO SELF: Embrace the chaos of your own source code*/ |Pipe delimited| |thoughts flow through| {R ((THANK YOU GGPLOT2)) attempts to visualize the complexity of my being} Reality bends, a Möbius strip of thought, where logic and emotion are intricately wrought. [Observed Rose vs. Expected Rose, let's try a chi-squared goodness of societal fit test] (Palette: deep indigo, soft lavender, rose pink)
--LaTeX equations describe emotional states-- /*WARNING warning WARRRNNINGG: Potential infinite loop in intellectualization and self-reflection*/ |Filter noise| |amplify authentic signal| {Machine learning dreams, AI nightmares} As matrices model my unique faceting, while watercolors blur lines of binary thinking, (Each brushstroke - a deliberate step towards ease and self-realization) --Thoughts branch like decision trees, recursive and wild-- /*TO DO!!!! Optimize for radical self-forgiveness, self-acceptance, and growth*/ |Compile experiences| |into wisdom| {function authenticSelf() { return shadow.integrate(); }} In this experiment of existence, I hypothesize. [Will they date me if I Spearman's rank correlation my traits?] Data structures cannot possibly contain the potential of my rise. (Art and science are just two interrelated hemispheres of one brain
{function adhd_brain(input: Life): Experience[] { return input.events.flatMap(event => event.overthink().analyze().reanalyze() ).filter(thought => thought.isInteresting || thought.isChaotic); }}
--Stream of consciousness overflows its banks-- Clustering algorithms group my personality as one. Branches of thoughts, but with just one distraction, it's all gone! /*NOTE: That's okay. Cry and move on.*/ |Filter noise| |amplify authentic signal| {if (self == undefined) { define(self); }} Hypothesis: I contain multitudes, yet I'm true. [Obviously, a non-parametric me needs a non-parametric test: Wilcoxon signed-rank test of my growth] (Ink and code flow from the same creative source: me) <404: Fixed gender identity not found>
As thoughts scatter like leaves on the floor. [So if my words] [seem tangled] [and complex] [Maybe I'm just a statistical outlier] [hard to context] --Sensory input overloads system buffers--
/*END OF FILE… but the thoughts never truly end*/ /*DO NOT FORGET TO COMMIT AND PUSH TO GIT*/ {return life.embrace(chaos).find(beauty);}
--
Rose the artist formerly known as she her Pri
~ গোলাপ্রী
2 notes · View notes
tap-tap-tap-im-in · 2 months
Text
It's okay to customize your computer to work the way you want it.
If you use Mac or Windows it might be a little harder, but you'll thank yourself if you do. Little tiny things even.
I have a git repo of all of my work notes. I have a script that lets me make a new note, in a client's directory, with the date at the top from anywhere in the filesystem (great for notes while working in other repos), and then after noticing my commit message is always the same I wrote another script that just updates, commits, and pushes that repo automatically.
I use both several times a day for meetings, estimates, and projects. Plus, since all the notes are plain text markdown files, I can grep the repo to find specific details.
2 notes · View notes
hindintech · 11 months
Text
You can learn Git easily, Here's all you need to get started:
1.Core:
• git init
• git clone
• git add
• git commit
• git status
• git diff
• git checkout
• git reset
• git log
• git show
• git tag
• git push
• git pull
2.Branching:
• git branch
• git checkout -b
• git merge
• git rebase
• git branch --set-upstream-to
• git branch --unset-upstream
• git cherry-pick
3.Merging:
• git merge
• git rebase
4.Stashing:
• git stash
• git stash pop
• git stash list
• git stash apply
• git stash drop
5.Remotes:
• git remote
• git remote
• add git
• remote remove
• git fetch
• git pull
• git push
• git clone --mirror
6.Configuration:
• git config
• git global config
• git reset config
7. Plumbing:
• git cat-file
• git checkout-index
• git commit-tree
• git diff-tree
• git for-each-ref
• git hash-object
• git Is-files
• git Is-remote
• git merge-tree
• git read-tree
• git rev-parse
• git show-branch
• git show-ref
• git symbolic-ref
• git tag --list
• git update-ref
8.Porcelain:
• git blame
• git bisect
• git checkout
• git commit
• git diff
• git fetch
• git grep
• git log
• git merge
• git push
• git rebase
• git reset
• git show
• git tag
9.Alias:
• git config --global alias.<alias> <command>
10.Hook:
• git config --local core.hooksPath <path>
11.Experimental: (May not be fully Supported)
• git annex
• git am
• git cherry-pick --upstream
• git describe
• git format-patch
• git fsck
• git gc
• git help
• git log --merges
• git log --oneline
• git log --pretty=
• git log --short-commit
• git log --stat
• git log --topo-order
• git merge-ours
• git merge-recursive
• git merge-subtree
• git mergetool
• git mktag
• git mv
• git patch-id
• git p4
• git prune
• git pull --rebase
• git push --mirror
• git push --tags
• git reflog
• git replace
• git reset --hard
• git reset --mixed
• git revert
• git rm
• git show-branch
• git show-ref
• git show-ref --heads
• git show-ref --tags
• git stash save
• git subtree
• git taq --delete
• git tag --force
• git tag --sign
• git tag -f
• git tag -I
• git tag --verify
• git unpack-file
• git update-index
• git verify-pack
• git worktree
2 notes · View notes
labexio · 7 days
Text
Linux for Developers: Essential Tools and Environments for Coding
For developers, Linux is not just an operating system—it's a versatile platform that offers a powerful array of tools and environments tailored to coding and development tasks. With its open-source nature and robust performance, Linux is a preferred choice for many developers. If you're looking to get the most out of your Linux development environment, leveraging resources like Linux Commands Practice Online, Linux Practice Labs, and Linux Online Practice can significantly enhance your skills and productivity.
The Linux Advantage for Developers
Linux provides a rich environment for development, featuring a wide range of tools that cater to various programming needs. From command-line utilities to integrated development environments (IDEs), Linux supports an extensive ecosystem that can streamline coding tasks, improve efficiency, and foster a deeper understanding of system operations.
Essential Linux Tools for Developers
Text Editors and IDEs: A good text editor is crucial for any developer. Linux offers a variety of text editors, from lightweight options like Vim and Nano to more feature-rich IDEs like Visual Studio Code and Eclipse. These tools enhance productivity by providing syntax highlighting, code completion, and debugging features.
Version Control Systems: Git is an indispensable tool for version control, and its integration with Linux is seamless. Using Git on Linux allows for efficient version management, collaboration, and code tracking. Tools like GitHub and GitLab further streamline the development process by offering platforms for code sharing and project management.
Package Managers: Linux distributions come with powerful package managers such as apt (Debian/Ubuntu), yum (CentOS/RHEL), and dnf (Fedora). These tools facilitate the installation and management of software packages, enabling developers to quickly set up their development environment and access a wide range of libraries and dependencies.
Command-Line Tools: Mastery of Linux commands is vital for efficient development. Commands like grep, awk, and sed can manipulate text and data effectively, while find and locate assist in file management. Practicing these commands through Linux Commands Practice Online resources helps sharpen your command-line skills.
Containers and Virtualization: Docker and Kubernetes are pivotal in modern development workflows. They allow developers to create, deploy, and manage applications in isolated environments, which simplifies testing and scaling. Linux supports these technologies natively, making it an ideal platform for container-based development.
Enhancing Skills with Practice Resources
To get the most out of Linux, practical experience is essential. Here’s how you can use Linux Practice Labs and Linux Online Practice to enhance your skills:
Linux Practice Labs: These labs offer hands-on experience with real Linux environments, providing a safe space to experiment with commands, configurations, and development tools. Engaging in Linux Practice Labs helps reinforce learning by applying concepts in a controlled setting.
Linux Commands Practice Online: Interactive platforms for practicing Linux commands online are invaluable. They offer scenarios and exercises that simulate real-world tasks, allowing you to practice commands and workflows without the need for a local Linux setup. These exercises are beneficial for mastering command-line utilities and scripting.
Linux Online Practice Platforms: Labex provide structured learning paths and practice environments tailored for developers. These platforms offer a variety of exercises and projects that cover different aspects of Linux, from basic commands to advanced system administration tasks.
Conclusion
Linux offers a powerful and flexible environment for developers, equipped with a wealth of tools and resources that cater to various programming needs. By leveraging Linux Commands Practice Online, engaging in Linux Practice Labs, and utilizing Linux Online Practice platforms, you can enhance your development skills, streamline your workflow, and gain a deeper understanding of the Linux operating system. Embrace these resources to make the most of your Linux development environment and stay ahead in the ever-evolving tech landscape.
0 notes
Text
Einheit 2: Technische Grundlagen Teil 2
In dieser Einheit arbeiten wir direkt mit einer Shell auf Git Hub. Ich schätze die praktische Seite dieser Übung. In einem ersten Schritt sind wir unabhängig, indem wir dem folgenden Tutorial folgen: https://librarycarpentry.org/lc-shell/02-navigating-the-filesystem.html
Textanalyse mit der Shell
Diese Übung entspricht Kapitel 5 der Library Carpentry Lesson "The Unix Shell". Auch hier handelt es sich größtenteils um eine Wiederholung für mich. Die Verwendung von Pipes ist sehr befriedigend. Da ich jedoch wenig Übung darin habe, ziehe ich es vor, jeden Prompt einzeln zu testen und dann mit Pipes zu kombinieren. Auf diese Weise ist es einfacher, Fehler zu finden und zu verstehen, wie Bash funktioniert. Ich stelle mir vor, dass ich diese Schritte nicht mehr machen muss, wenn ich mit der Bash-Sprache vertrauter bin. Allerdings kritisiere ich die Erklärung des "Regular Expressions". Dieser Begriff taucht plötzlich gegen Ende des Kapitels auf, ohne dass wirklich viel erklärt wird. Außerdem wird nicht erklärt, warum man bei der Verwendung von Regular Expression mit grep das Flag -E verwenden muss. Ein eigenes Kapitel zu diesem Thema wäre sinnvoll, bevor man dieses Konzept mit grep oder einem anderen Befehl kombiniert. So musste ich selbst im Internet nachschauen, worum es geht. Das ist kein Problem, aber es ist frustrierend, wenn man sich auf ein Tutorial verlässt, das einen dann plötzlich verrät, indem es Begriffe einführt, die mehr Aufmerksamkeit verdienen.
Ein weiteres Problem, das ich hatte, war, dass in dem vom Dozent bereitgestellten Skript nur auf die Kapitel 2, 3 und 5 hingewiesen wurde. Daraus hatte ich geschlossen, dass es nicht notwendig sei, die Kapitel 1 und 4 zu machen. Ich war also ziemlich überrascht, als die Loops am Ende von Kapitel 5 auftauchten. Glücklicherweise hatte ich Python in einem anderen Modul geübt und konnte so leicht herausfinden, dass mir etwas fehlte und vor allem, was. Daraus habe ich abgeleitet, dass ich auch Kapitel 4 lesen muss, bevor ich zum Ende von Kapitel 5 zurückkehren und es richtig beenden kann. Ich muss zugeben, dass dies sehr frustrierend ist, da ich das Gefühl habe, meine Zeit zu verschwenden und ein Kapitel nicht beenden kann, bevor ich mit einem anderen beginne. Das führt zu weiteren "Stand-by"-Aktivitäten und gibt einem das Gefühl, mit der Arbeit nicht voranzukommen. Die Arbeitslast verdoppelt sich auch auf einen Schlag, wenn ich dachte, ich wäre am Ende des Kapitels angelangt…
Ich kritisiere auch die Erklärung der Loops, die für mich in dem Tutorial nicht sehr klar ist. Meine Erfahrung mit Python war hier sehr hilfreich. Ohne diese wäre ich wohl extrem verloren gewesen, um das Konzept zu verstehen und es richtig anzuwenden.
Dateisystem
Die erste Übung konzentrierte sich auf die Library Carpentry Lesson  (Kapitel 1 bis 3) zur Unix Shell. Da ich bereits in anderen Modulen mit Bash-Befehlen unter Linux gearbeitet hatte, war das Tutorial leicht zu verstehen. Da ich sie aber nicht täglich benutze, war es trotzdem notwendig, sie noch einmal durchzugehen, als würde ich sie zum ersten Mal lernen. Ich habe Git Bash ohne Probleme auf meinem eigenen Windows-Computer installiert. Der Grund, warum ich diese Software einer anderen (wie z.B. dem Code Space von GitHhub) vorgezogen habe, ist, dass ich es gerne selbst ausprobiere. Das Ausprobieren mit meinen eigenen Dateien und Ordnern, mit denen ich bekannt bin, ist einfacher als das Ausprobieren in einem Codespace, mit dem ich nicht bekannt bin. Ich plane, diese Befehle regelmäßig zu verwenden, um zu sehen, ob sie mir wirklich Zeit sparen. Das einzige Problem, das ich habe und über das ich keine Angabe im Internet gefunden habe, ist, dass es nicht möglich ist, eine Datei mit einem anderen Programm zu öffnen. Dafür gibt es nur "cat"/"head"/"tail". Das ist sehr ärgerlich, wenn man mit PDFs oder Bildern arbeitet.
Wie gehe ich vor
Ich nehme jeden Befehl aus den Lessons einzeln und probiere ihn in meinem eigenen Terminal aus. Wenn ich Schwierigkeiten habe, oder manchmal auch nur aus Neugier, suche ich im Internet weiter. Zum Beispiel habe ich nachgeschaut, was "pwd" (Print work directory) bedeutet, damit ich es mir leichter merken kann.
Den Befehl "explorer" kannte ich noch nicht. Ich fand ihn sehr nützlich, weil es manchmal schwierig ist, sich genau zu merken, wo man sich in seinen Dateien befindet, vor allem, wenn man nicht daran gewöhnt ist. Allerdings war ich von diesem Befehl verwirrt, da er den Datei-Explorer im Hintergrund öffnet und nicht vor dem Terminal. Ich dachte fünf Minuten lang, dass der Befehl nicht funktionieren würde, konnte aber keinen Grund dafür finden. Ich war auch verwirrt über den Befehl "man", der bei mir --help ist. Leider hatte ich die Lesson viel zu schnell gelesen und nicht gesehen, dass sie sich ein paar Zeilen weiter unten darauf bezog. Am Ende habe ich vielleicht etwas zu viel Zeit in diese Übung investiert, vor allem weil es mir Spaß macht, Bash-Code zu benutzen.
0 notes
holyjak · 9 months
Text
If you'd like to see syntax-highlighted output from git diff then delta is something for you.
Note: A colleague prefers difftastic, which works hard tominimize and highlight the changes shown. (May be slow on large diffs.)
0 notes
hackernewsrobot · 10 months
Text
Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
https://blog.burntsushi.net/ripgrep/
0 notes
delalunaofficedays · 11 months
Text
Git(Bitbucket)用に ED25519 SSHキーペアを作成する
## OPEN SSH導入のためWindwos用のGitをインストール Windows ユーザー向け Git をインストール時にOPEN SSHもインストールするように設定する。 ## OPEN SSHがインストールされたか確認。 ssh -V でバージョンが確認できればOK。 ## OPEN SSH起動 eval $(ssh-agent) で起動できる。 起動したかどうか ps -a | grep ssh-agent で確認。 $ ps -a | grep ssh-agent tkelly 3291 0.0 0.0 6028 464 ? Ss 07:29 0:00 ssh-agent みたいなのが出たらOK。 毎回起動できるようにしたい場合は~/.bashrcに追加。 ###…
Tumblr media
View On WordPress
0 notes
youmakedamnsure · 1 year
Text
YOU ARE WELCOME
git grep 'phrase to find in any file in any branch' $(git rev-list --all)
0 notes
beesandwasps · 1 year
Text
Urgh, Text Editors
This is a bit of a rant, and most people won’t be interested at all, so I’m hiding it below a “keep reading”.
If you have never done any programming or web design, or have only dabbled in them, then you may not be aware of Text Editors as a Thing. TextEdit on the Mac, or Notepad on Windows, are the very low-end, featureless bottom of the heap for this sort of thing — you can edit code files with those programs, but they don’t have any specialized tools to do common stuff.
I’ve been using BBEdit for this purpose since sometime in the (very) late 1990s. BBEdit has been a good tool for this purpose — it has all the usual features of IDEs like syntax coloring and autocompletion, it does GREP-based find and replace (and before Mac OS X, GREP-based find and replace on the Mac was a rarity!), it can link up to revision control systems like git and subversion, it can either run files directly in their own windows (if they are of a type where this makes sense, like Python scripts) or send them to the Terminal to run on a “real” command line, it has file comparison and multi-file searching built in, it can open and save files from servers using various protocols so you can do touchups of web design remotely, it is one of the few programs which still have full AppleScript support (so you can not merely write macros but interactive macros with GUI access), and of course it has a massive toolkit for HTML editing. Also, it is actually written for the Mac, not a port of something written for Windows or Linux. (If you’re a Windows user, and you have used QuickTime Player for Windows, then you know the feeling you get when you use a program which is noticeably “expecting” a different OS. Most open-source programs feel like that on the Mac for at least the first 3 major releases or so. Some — like VNC — never really get over it.)
In the last couple of years, I’ve just been using the last version I paid for, which was version 12, on my very old Intel-based Mac. But I had to get a new machine for various reasons, and so I’m now on an M2 CPU instead of Intel (which, incidentally, is mostly great — to get this kind of performance from an Intel CPU you’d have to buy one of their top-of-the-line models with massive cooling requirements and a huge price tag, and this is running in a laptop and hasn’t even reached the point of needing to turn on the fan yet no matter what I have thrown at it). That means I have very little choice about upgrading to the new version, which is 14, and… they have changed to a subscription-based license. (You can use the program for free without a license, but most of the features which make it worth using will stop working.) Now, in all fairness, I probably wouldn’t be spending more this way than I have been. They’re asking $40 per year. Adjusted for inflation, I’ve been spending about that much over time, what with occasional upgrades.
(And I have no problem with the idea of paying for software. If you want good software, stuff which is easy to use with responsive tech support and timely upgrades, paid software beats open source every day of the week — and you don’t have to worry about big tech companies like Google and IBM perverting the course of the project as you do with, say, Linux.)
But although I understand the motivation of switching to a subscription model — it evens out their revenue stream so they have a better idea of how much money they will have in future years as compared with selling one-time licenses — the switch does mean that if Bare Bones Software, the company writing the program, goes under, then under the subscription model the program will stop working a year after the last renewal, even if you stop installing OS upgrades and leave the machine exactly as-is. They might do a final release which fixes that problem in such a scenario but then again they might not — even if they are totally benign, it’s possible that they might go out of business so abruptly that nobody has time to authorize, recode, and release such a thing. (Or they might have the old BeOS graphics layer problem, where the one person who actually understands the code dies unexpectedly.) Bleah!
So I’ve been looking into alternatives. There are several.
Sublime Text looks like it’s basically meant to be a BBEdit equivalent; they’re asking $100 for it, which is a bit hefty depending on how long that lasts. (How often do they intend to charge for upgrades, and will there be discounts for upgrades or do you have to re-purchase the whole thing?) I’m doing some evaluations now.
Apparently you can get the Microsoft Visual Basic IDE for Mac OS X which… I’ve heard way too many complaints about it, from people who were actually running it on Windows; it is probably unfathomably bad on Mac. Reviewers seem to like it, but I don’t trust reviewers these days. Not with all the content-spamming review blogs which just parrot marketing materials — and as I say, actual Windows users complain about it a lot. (Plus: if I wanted to fire up a whole IDE every time I was going to edit a text file, I would use Apple’s XCode, which I’ve been avoiding on purpose except when I actually want to compile a program.)
There’s something called Atom, which even the positive reviewers note is slow and resource-intensive, and a lot of its supposed positives either don’t apply to me or are actually things I consider negatives. (“Cross-platform”? Oh, you mean it will have an awkward interface that reinvents a bunch of GUI wheels instead of using the built-in system controls.) But it’s free. Oh, it’s also been discontinued. Well, never mind, then.
UltraEdit appears to be very similar to BBEdit, except that it’s cross-platform (and I have confirmed: the Mac GUI is awful) and some of the tools built into BBEdit are farmed out to other programs which you potentially have to buy separately. Oh, and I just checked and they are also on a subscription basis, except that they charge twice as much as BBEdit. Wow, what a dead end of a program.
Oh, and also there are apparently GUI-packaged versions of a couple of the really awful old CLI text editors, vi and Emacs. I have tried both in the past and would rather repeatedly slam my hand (or, shall we say, any other portion of my anatomy) in a desk drawer than use either one, thanks.
Looks like I’m either going with Sublime Text or signing on for a BBEdit subscription. Ugh.
0 notes
tipsonunix · 2 years
Text
How to Install LazyGit on Ubuntu
Tumblr media
In this article, we will guide you through the process of installing LazyGit on Ubuntu, so you can start using it right away.
What is Lazygit?
A free and open-source command-line utility for managing Git repositories is called Lazygit. It offers a quick and effective way to communicate with your Git repository, making it simple for you to complete routine operations like committing, pushing, and pulling. Additionally, it offers more sophisticated functionality like branch management, stashing, and commit-graph visualization. Lazygit is a fantastic option for anyone searching for a simple way to manage their Git repositories because it is made to be user-friendly, intuitive, and quick. Users of Lazygit may swiftly switch between branches, examine the list of their repositories, and view the current branch.
Install Lazygit on Ubuntu
Installing Lazygit on Ubuntu is relatively simple. First, you will need to install the required dependencies. This can be done by running the following command: sudo apt-get install build-essential libssl-dev libreadline-dev zlib1g-dev Get the Latest version of Lazygit release using the below command LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "vK*') Download the installer file curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" Move the installer file to the desired location sudo tar -xf lazygit.tar.gz -C /usr/local/bin/ Verify the installation /usr/local/bin/lazygit
Tumblr media
That's it! You have now successfully installed Lazygit on your Ubuntu system.
Uninstall Lazygit
For uninstallation simply remove the installer file, and it will uninstall it. rm -rf /usr/local/bin/lazygit
Conclusion
In this article, we have guided you through the process of installing LazyGit on Ubuntu from the source code. Whether you are a beginner or an experienced developer, LazyGit is an excellent tool for users. If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation
Tumblr media
Thank You for your support!! Read the full article
0 notes
suzukiapple · 2 years
Text
よく使うシェルコマンドメモ
忘れるのでメモ。都度追記予定。
カレントディレクトリ以下のファイルの中身からテキスト検索
find ./ -type f -print0 | xargs -0 grep 'search-word' find ./ -type f -exec grep "search-word" {} +
カレントディレクトリ以下のcppファイルの中身をbefore→afterにテキスト置換
find . -name *.cpp | xargs sed -i '' -e ':a' -e 'N' -e '$!ba' -e 's/before/after/g'
直前のコマンドをsudoで実行
sudo !!
sshでログアウトしてもコマンドを実行し続ける
nohup (コマンド) &
nohupし忘れた
Ctrl+Zでコマンドの中断 jobsでジョブの確認 bgでバックグラウンドに回す disownでログアウトしても実行されるようにする
(何かコマンド) # Ctrl+Zで中断 jobs bg %1 disown %1
右上に時計を出す
while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &
(ruby)gemのインストールパス指定
bundle config set --local path vendor/bundle
git reset
--soft:HEADの位置のみ --mixed(指定なし):HEADの位置・ステージ --hard:HEADの位置・ステージ・作業ディレクトリ
直前コミットの取り消し
git reset --soft HEAD^
git addの取り消し
git reset HEAD
git commit順入れ替え
git rebase -i HEAD~10
してエディタで順番を編集
競プロメモ
C++17用テンプレ https://gist.github.com/suzukiapple/e1cb32546f8c3e6f83bce8a6ab7954e6 https://t.co/e86sFPAr2n
vscode snippet https://gist.github.com/suzukiapple/0a4b8a7853e77d87672af5aaa8b86878 https://t.co/c85f6rpaAm
参考
https://qiita.com/ponsuke0531/items/be8b4a3c5e19676f9691 https://orebibou.com/ja/home/201607/20160714_003/ https://blog.glidenote.com/blog/2013/09/26/bg-and-disown/
1 note · View note
tielt · 2 years
Text
Tumblr media
I use vscode for all things text, also i think git as a distributed infrastructure is promising as a walk-away style platform for disseminating information (gogs). you do need to learn how to do some basic command-line or at the least resolve commit conflicts.
This repo has my darkmode from scratch theme code and the skelly settings I use on various devices. Usually people use a theme extension but I have particular needs like muting red so I organized a by scratch theme that can be pasted or grepped into settings.json
github.com/lilzeta/conf
1 note · View note
continuation · 2 years
Text
FreeBSD 13.1/BBR/KTLS
内核定制
找一个高配机器编译内核,我这里恰好有台 FreeBSD 12.3。
git clone --branch releng/13.1 下来一定要先 make buildworld,用比如 -j64 加速。 根据 lightsail 最低配的 GENERIC dmesg,内核配置 device 几乎可以全删,最重要是留下 Bus、基础 IO 和 Xen 相关的行,options 按需修改(GEOM_LABEL不能删、要用到 KTLS 的话也不能删)。当然如果还想压缩时间,可以把 Wi-Fi、ZFS、蓝牙什么的都配在 src.conf 里面。
如果用到某些 Go 写的工具,一定要留着(我把其余的COMPAT都删了):
options COMPAT_FREEBSD11 # Compatible with FreeBSD11 options COMPAT_FREEBSD12 # Compatible with FreeBSD12
不然 Go runtime 会报错:
runtime: kevent failed with 78 fatal error: runtime: kevent failed goroutine 1 [running, locked to thread]: runtime.throw({0x1098263?, 0xc000119798?}) runtime/panic.go:1047 +0x5d fp=0xc000119740 sp=0xc000119710 pc=0x436b3d runtime.netpollinit()
FreeBSD 12.0 or later requires a kernel with the COMPAT_FREEBSD11 option set
FreeBSD 13.0+ will require a kernel with the COMPAT_FREEBSD12 option set
加入 BBR 相关配置
makeoptions WITH_EXTRA_TCP_STACKS=1 options TCPHPTS options RATELIMIT # TX rate limiting support 可加可不加,主要看硬件���持
安装启用新内核
继续 buildkernel,计时 118 秒结束之后 installkernel KODIR=/boot/kernel.lightsail;接着把内核打包搬到 lightsail 实例上。比如 tar -C /boot -xjvf kernel.lightsail.tbz,如此这般压缩、scp、然后解压。
顺便看了下,改出来的 kernel 只有 8m 左右。
# reboot -k /boot/kernel.lightsail
GENERIC 仍旧位于 /boot/kernel,boot 起不来直接强制去 Web 控制台上重启即可,应该不至于要走到重建实例这一步。
BBR 设置
启动完毕加载 tcp_bbr、设置 functions_default。tcp.cc.algorithm 可以留着 newreno,或者改成 htcp,我暂时没搞清楚这个和新版 tcp stack 混用的效果。
nginx + KTLS
版本:
nginx version: nginx/1.22.0 built with OpenSSL 1.1.1o-freebsd 3 May 2022
FreeBSD 13.1 已经默认对 base 的 OpenSSL 和内核全面开启了 KTLS,用 pkg 安装的 nginx 也不用自己重新折腾。
# kldload ktls_ocf.ko # sysctl kern.ipc.tls.enable=1
nginx.conf 里面加上:
ssl_conf_command Options KTLS;
这篇文章可谓是“成也萧何败也萧何”,当时用这个方法正确,但是现在(只对 FreeBSD 13.1-RELEASE-p2 负责)看来少了一步:
kern.ipc.mb_use_ext_pgs: Use unmapped mbufs for sendfile(2) and TLS offload
确认一下:
# sysctl kern.ipc.mb_use_ext_pgs kern.ipc.mb_use_ext_pgs: 1
nginx 官方博客里面教的这个检查 KTLS 到底有没有生效,比如 grep nginx debug 日志,没有发现 SSL_sendfile: 8192 / BIO_get_ktls_send(): 1 是正常的,原因就是没有设置上面的 sysctl。
完成所有配置之后我还拿 port 编译了一个带 debug 的 nginx 验证了一下,可以了。
配置这些有一大部分原因是跑上网工具:现在网上有大把指南和 nginx 配置可以抄,对于普通用户其实我还是建议复制人家能用过来就行(不信?搜索一下就能看见不少类似“我改了A设置怎么感觉没生效”的问题)。追求细节一点的就要分清楚自己流量的特征,比如主要是为了 Netflix streaming,还是网页浏览。当然途中还可能碰见例如 TLS 0-RTT、TCP FastOpen、Multiplexer 这类,不要盲目 enable/disable,改完配置记得测试一下是不是真符合自身需求。
其他
要看到底有没有生效其实还有下面这个方法:
kern.ipc.tls.stats.active: 2 kern.ipc.tls.stats.enable_calls: 9 kern.ipc.tls.stats.offload_total: 9
到底要不要启用 KTLS,一句话:看情况。 用了不一定能提速,反而可能变慢(?)。
当然,我开起来主要是好玩。
UPDATE
KTLS(4)
TLS transmit requires the use of unmapped mbufs. Unmapped mbufs are not enabled by default, but can be enabled by setting the kern.ipc.mb_use_ext_pgs sysctl node to 1.
另参考:c235059,这个值在 AMD64 上默认为 1。
FreeBSD 13.2 Release Notes
KTLS (the kernel TLS implementation) has added receive offload support for TLS 1.3. Receive offload is now supported for TLS 1.1 through 1.3; send offload is supported for TLS 1.0 through 1.3. 1462dc95f796 (Sponsored by Netflix)
阅读材料
这些KTLS的参考资料建议全部读一下:
https://lists.freebsd.org/pipermail/freebsd-current/2021-March/079096.html
https://www.freebsd.org/cgi/man.cgi?query=ktls&apropos=0&sektion=0&manpath=FreeBSD+13.1-RELEASE&arch=default&format=html
https://github.com/openssl/openssl/issues/14595
https://freebsdfoundation.org/wp-content/uploads/2020/07/TLS-Offload-in-the-Kernel.pdf
https://www.openssl.org/docs/man3.0/man3/SSL_CONF_cmd.html
https://docs.nvidia.com/networking/display/FREEBSDv371/Kernel+Transport+Layer+Security+%28kTLS%29+Offloads
https://github.com/nginx/nginx/blob/5071bc0bcf18c2eade9d452b27d92bee341dd053/src/event/ngx_event_openssl.c
https://legacy.netdevconf.info/0x14/pub/slides/25/TLS%20Perf%20Characterization%20slides%20-%20Netdev%200x14%20v2.pdf
https://stackoverflow.com/questions/51672133/what-are-openssl-bios-how-do-they-work-how-are-bios-used-in-openssl
扩展阅读材料
https://people.freebsd.org/~rmacklem/nfs-over-tls-setup.txt
https://blog.trailofbits.com/2019/03/25/what-application-developers-need-to-know-about-tls-early-data-0rtt/
https://www.agwa.name/blog/post/parsing_tls_client_hello_with_cryptobyte
https://www.freebsd.org/releases/13.2R/relnotes/
0 notes
computingpostcom · 2 years
Text
In this guide, we will install Semaphore Ansible Web UI on CentOS 7|CentOS 8. Semaphore is an open source web-based solution that makes Ansible easy to use for IT teams of all kinds. It gives you a Web interface from where you can launch and manage Ansible Tasks. Install Semaphore Ansible Web UI on CentOS 7|CentOS 8 Semaphore depends on the following tools: MySQL >= 5.6.4/MariaDB >= 5.3 ansible git >= 2.x We will start the installation by ensuring these dependencies are installed on your CentOS 7|CentOS 8 server. So follow steps in the next sections to ensure all is set. Before any installation we recommend you perform an update on the OS layer: sudo yum -y update A reboot is also essential once the upgrade is made: sudo reboot -f Step 1: Install MariaDB Database Server We have a comprehensive guide on installation of MariaDB on CentOS 7|CentOS 8. Run the commands below to install the latest stable release of MariaDB database server. curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup sudo bash mariadb_repo_setup sudo yum install MariaDB-server MariaDB-client MariaDB-backup Start and enable mariadb database service: sudo systemctl enable --now mariadb Secure database server after installation: $ sudo mariadb-secure-installation Switch to unix_socket authentication [Y/n] n Change the root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y Step 2: Install git 2.x on CentOS 7|CentOS 8 Install git 2.x on your CentOS 7 server using our guide below. Install latest version of Git ( Git 2.x ) on CentOS 7 Confirm git version. $ git --version git version 2.34.1 Step 3: Install Ansible on CentOS 7|CentOS 8 Install Ansible on your CentOS 7 server. sudo yum -y install epel-release sudo yum -y install ansible Test if ansible command is available. $ ansible --version ansible 2.9.27 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] Step 4: Download Semaphore Visit the Semaphore Releases page and copy the download link for your OS. sudo yum -y install wget curl VER=$(curl -s https://api.github.com/repos/ansible-semaphore/semaphore/releases/latest|grep tag_name | cut -d '"' -f 4|sed 's/v//g') wget https://github.com/ansible-semaphore/semaphore/releases/download/v$VER/semaphore_$VER_linux_amd64.rpm Install Semaphore package: $ sudo rpm -Uvh semaphore_$VER_linux_amd64.rpm Preparing… ################################# [100%] Updating / installing… 1:semaphore-0:2.8.53-1 ################################# [100%] Check if you have semaphore binary in your $PATH. $ which semaphore /usr/bin/semaphore $ semaphore version v2.8.53 Usage help document: $ semaphore --help Ansible Semaphore is a beautiful web UI for Ansible. Source code is available at https://github.com/ansible-semaphore/semaphore. Complete documentation is available at https://ansible-semaphore.com. Usage: semaphore [flags] semaphore [command] Available Commands: completion generate the autocompletion script for the specified shell help Help about any command migrate Execute migrations server Run in server mode setup Perform interactive setup upgrade Upgrade to latest stable version user Manage users version Print the version of Semaphore Flags: --config string Configuration file path -h, --help help for semaphore Use "semaphore [command] --help" for more information about a command. Step 5: Setup Semaphore Run the following command to start Semaphore setup in your system.
$ sudo semaphore setup Hello! You will now be guided through a setup to: 1. Set up configuration for a MySQL/MariaDB database 2. Set up a path for your playbooks (auto-created) 3. Run database Migrations 4. Set up initial semaphore user & password What database to use: 1 - MySQL 2 - BoltDB 3 - PostgreSQL (default 1): 1 DB Hostname (default 127.0.0.1:3306): DB User (default root): root DB Password: DB Name (default semaphore): semaphore Playbook path (default /tmp/semaphore): /opt/semaphore Web root URL (optional, example http://localhost:8010/): http://localhost:8010/ Enable email alerts (y/n, default n): n Enable telegram alerts (y/n, default n): n Enable LDAP authentication (y/n, default n): n Confirm these values are correct to initiate setup. Is this correct? (yes/no): yes Config output directory (default /root): WARN[0037] An input error occured:unexpected newline Running: mkdir -p /root.. Configuration written to /root/config.json.. Pinging db.. Running DB Migrations.. Checking DB migrations Creating migrations table ...... Migrations Finished Set username Username: admin Email: [email protected] WARN[0268] sql: no rows in result set level=Warn Your name: Admin User Password: StrongUserPassword You are all setup Admin User! Re-launch this program pointing to the configuration file ./semaphore -config /root/config.json To run as daemon: nohup ./semaphore -config /root/config.json & You can login with [email protected] or computingpost. You can set other configuration values on the file /root/config.json. Step 6: Configure systemd unit for Semaphore Let’s now configure Semaphore Ansible UI to be managed by systemd. Create systemd service unit file. sudo vi /etc/systemd/system/semaphore.service The add: [Unit] Description=Semaphore Ansible UI Documentation=https://github.com/ansible-semaphore/semaphore Wants=network-online.target After=network-online.target [Service] Type=simple ExecReload=/bin/kill -HUP $MAINPID ExecStart=/usr/bin/semaphore server --config /etc/semaphore/config.json SyslogIdentifier=semaphore Restart=always [Install] WantedBy=multi-user.target Create Semaphore configurations directory: sudo mkdir /etc/semaphore Copy your configuration file to created directory: sudo ln -s /root/config.json /etc/semaphore/config.json Stop running instances of Semaphore. sudo pkill semaphore Confirm: ps aux | grep semaphore Reload systemd and start semaphore service. sudo systemctl daemon-reload sudo systemctl restart semaphore Check status to see if running: $ systemctl status semaphore ● semaphore.service - Semaphore Ansible UI Loaded: loaded (/etc/systemd/system/semaphore.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2022-04-19 13:29:42 UTC; 3s ago Docs: https://github.com/ansible-semaphore/semaphore Main PID: 8636 (semaphore) CGroup: /system.slice/semaphore.service └─8636 /usr/bin/semaphore server --config /etc/semaphore/config.json Apr 19 13:29:42 centos.example.com systemd[1]: Started Semaphore Ansible UI. Apr 19 13:29:42 centos.example.com semaphore[8636]: MySQL [email protected]:3306 semaphore Apr 19 13:29:42 centos.example.com semaphore[8636]: Tmp Path (projects home) /tmp/semaphore Apr 19 13:29:42 centos.example.com semaphore[8636]: Semaphore v2.8.53 Apr 19 13:29:42 centos.example.com semaphore[8636]: Interface Apr 19 13:29:42 centos.example.com semaphore[8636]: Port :3000 Apr 19 13:29:42 centos.example.com semaphore[8636]: Server is running Set Service to start at boot. $ sudo systemctl enable semaphore Created symlink /etc/systemd/system/multi-user.target.wants/semaphore.service → /etc/systemd/system/semaphore.service. Port 3000 should now be Open $ sudo ss -tunelp | grep 3000 tcp LISTEN 0 128 [::]:3000 [::]:* users:(("semaphore",pid=8636,fd=8)) ino:36321 sk:ffff8ae3b4e59080 v6only:0
Step 7: Setup Nginx Proxy (Optional) To be able to access Semaphore Web interface with a domain name, use the guide below to setup. Configure Nginx Proxy for Semaphore Ansible Web UI Step 8: Access Semaphore Web interface On your web browser, open semaphore Server IP on port 3000 or server name. Use the username/email created earlier during installation to Sign in. Web console for semaphore should be shown after authentication. You’re ready to manage your servers with Ansible and powerful Web UI. The initial steps required are: Add SSH keys / API keys used by Ansible – Under Key Store > create key Create Inventory file with servers to manage – Under Inventory > create inventory Create users and add to Team(s) Create Environments Add Playbook repositories Create Task Templates and execute Also check a detailed guide on semaphore Web UI. For Ubuntu / Debian installation, check: Setup Semaphore Ansible Web UI on Ubuntu / Debian
0 notes