Added connect-wifi, updated dart_language_server and rofi-emoji
This commit is contained in:
		
							parent
							
								
									f55ac7c20c
								
							
						
					
					
						commit
						197c089325
					
				@ -41,11 +41,11 @@
 | 
				
			|||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :CUSTOM_ID: h-400070eb-725f-4416-a4c6-da3053df750b
 | 
					  :CUSTOM_ID: h-400070eb-725f-4416-a4c6-da3053df750b
 | 
				
			||||||
  :END:
 | 
					  :END:
 | 
				
			||||||
 | 
					 | 
				
			||||||
- [[#presentation][Presentation]]
 | 
					- [[#presentation][Presentation]]
 | 
				
			||||||
- [[#4chandl][4chandl]]
 | 
					- [[#4chandl][4chandl]]
 | 
				
			||||||
- [[#askpass][Askpass]]
 | 
					- [[#askpass][Askpass]]
 | 
				
			||||||
- [[#backup][Backup]]
 | 
					- [[#backup][Backup]]
 | 
				
			||||||
 | 
					- [[#connectwifi][ConnectWifi]]
 | 
				
			||||||
- [[#cppnew][Cppnew]]
 | 
					- [[#cppnew][Cppnew]]
 | 
				
			||||||
- [[#cnew][Cnew]]
 | 
					- [[#cnew][Cnew]]
 | 
				
			||||||
- [[#dart-language-server][Dart Language Server]]
 | 
					- [[#dart-language-server][Dart Language Server]]
 | 
				
			||||||
@ -69,6 +69,7 @@
 | 
				
			|||||||
  - [[#ask-what-type-of-drive-to-unmount][Ask what type of drive to unmount]]
 | 
					  - [[#ask-what-type-of-drive-to-unmount][Ask what type of drive to unmount]]
 | 
				
			||||||
  - [[#launch-the-unmounting-functions][Launch the unmounting functions]]
 | 
					  - [[#launch-the-unmounting-functions][Launch the unmounting functions]]
 | 
				
			||||||
- [[#starwars][Starwars]]
 | 
					- [[#starwars][Starwars]]
 | 
				
			||||||
 | 
					- [[#updateflutter][UpdateFlutter]]
 | 
				
			||||||
- [[#wacom-setup][Wacom setup]]
 | 
					- [[#wacom-setup][Wacom setup]]
 | 
				
			||||||
  - [[#set-our-variables][Set our variables]]
 | 
					  - [[#set-our-variables][Set our variables]]
 | 
				
			||||||
  - [[#select-our-screen][Select our screen]]
 | 
					  - [[#select-our-screen][Select our screen]]
 | 
				
			||||||
@ -191,6 +192,28 @@
 | 
				
			|||||||
    cp $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S")
 | 
					    cp $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S")
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* ConnectWifi
 | 
				
			||||||
 | 
					  :PROPERTIES:
 | 
				
			||||||
 | 
					  :HEADER-ARGS: :tangle connect-wifi :exports code
 | 
				
			||||||
 | 
					  :CUSTOM_ID: h-7a958906-1f79-448f-95b3-7226bc80e88c
 | 
				
			||||||
 | 
					  :END:
 | 
				
			||||||
 | 
					  =connect-wifi= is  a small  utility tool  that allows the  user to  connect to
 | 
				
			||||||
 | 
					  available WiFi networks. The  first thing to do is to select  the WiFi we want
 | 
				
			||||||
 | 
					  to connect  to. We’ll  use the  =nmcli c  s= command  to get  the list  of the
 | 
				
			||||||
 | 
					  available networks, and we’ll chose one with =rofi=.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
 | 
					    set SELECTEDWIFI (nmcli d w l | egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | egrep -o '\s+(.*)\s+' | awk '{$1=$1}1' | rofi -dmenu -p "Select your WiFi network")
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					  Now, if  a network was  selected, let’s attempt  to connect to  it. Otherwise,
 | 
				
			||||||
 | 
					  let’s just send a notification no network was selected.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
 | 
					    if test -z $SELECTEDWIFI
 | 
				
			||||||
 | 
					        notify-send "No WiFi network selected" -u low && exit
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    nmcli c u $SELECTEDWIFI
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Cppnew
 | 
					* Cppnew
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :CUSTOM_ID: h-264945df-fe7a-4f9d-845a-9cc26c196f4b
 | 
					  :CUSTOM_ID: h-264945df-fe7a-4f9d-845a-9cc26c196f4b
 | 
				
			||||||
@ -209,6 +232,20 @@
 | 
				
			|||||||
  The choice is given to the user which of them to use with options that will be
 | 
					  The choice is given to the user which of them to use with options that will be
 | 
				
			||||||
  given to =cppnew=.
 | 
					  given to =cppnew=.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #+begin_src fish
 | 
				
			||||||
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					  #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  First of all, if no arguments were passed, return an error.
 | 
				
			||||||
 | 
					  #+begin_src fish
 | 
				
			||||||
 | 
					    if ! count $argv >/dev/null
 | 
				
			||||||
 | 
					        echo "Missing argument: PROJECT" && return -1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Now, let’s set a couple of variables which will prove useful later on when
 | 
				
			||||||
 | 
					  trying to set up our project.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Cnew
 | 
					* Cnew
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :CUSTOM_ID: h-a4ccdc0f-6813-4207-9479-4d68296f5fdb
 | 
					  :CUSTOM_ID: h-a4ccdc0f-6813-4207-9479-4d68296f5fdb
 | 
				
			||||||
@ -286,7 +323,7 @@
 | 
				
			|||||||
  should launch instead the following code:
 | 
					  should launch instead the following code:
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    #!/usr/bin/env fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp
 | 
					    /usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
  So, instead of  using the obsolete executable, instead we  will be calling the
 | 
					  So, instead of  using the obsolete executable, instead we  will be calling the
 | 
				
			||||||
  analysis server as requested.
 | 
					  analysis server as requested.
 | 
				
			||||||
@ -314,15 +351,15 @@
 | 
				
			|||||||
  emoji is selected, it is copied to the clipboard using =xclipboard=.
 | 
					  emoji is selected, it is copied to the clipboard using =xclipboard=.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    #!/usr/bin/env fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
					    grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Also, let’s send a notification telling the user the emoji has been copied!
 | 
					  Also, let’s send a notification telling the user the emoji has been copied!
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
					    set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
				
			||||||
    test -z "$emoji" && notify-send "No emoji copied" && exit
 | 
					    test -z "$emoji" && notify-send "No emoji copied" -u low && exit
 | 
				
			||||||
    set -a emoji "copied to clipboard"
 | 
					    set -a emoji "copied to clipboard"
 | 
				
			||||||
    pgrep -x dunst >/dev/null && notify-send $emoji
 | 
					    pgrep -x dunst >/dev/null && notify-send -u low $emoji
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish.
 | 
					  It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish.
 | 
				
			||||||
@ -1095,6 +1132,21 @@
 | 
				
			|||||||
    telnet towel.blinkenlights.nl
 | 
					    telnet towel.blinkenlights.nl
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* UpdateFlutter
 | 
				
			||||||
 | 
					  :PROPERTIES:
 | 
				
			||||||
 | 
					  :header-args: :tangle UpdateFlutter :exports code
 | 
				
			||||||
 | 
					  :CUSTOM_ID: h-1005db1f-aecc-4fca-be2d-98fd33c1461a
 | 
				
			||||||
 | 
					  :END:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  This is a simple utility to be ran when the ~flutter~ package is updated.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
 | 
					    #!/usr/bin/fish
 | 
				
			||||||
 | 
					    sudo chown -R :flutterusers /opt/flutter
 | 
				
			||||||
 | 
					    sudo chmod -R g+w /opt/flutter
 | 
				
			||||||
 | 
					    sudo chmod a+rw /opt/flutter/version
 | 
				
			||||||
 | 
					    sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Wacom setup
 | 
					* Wacom setup
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :CUSTOM_ID: h-e407ceef-2f14-4474-916b-6b687cf9f2e9
 | 
					  :CUSTOM_ID: h-e407ceef-2f14-4474-916b-6b687cf9f2e9
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								.local/bin/connect-wifi
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								.local/bin/connect-wifi
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					set SELECTEDWIFI (nmcli d w l | egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | egrep -o '\s+(.*)\s+' | awk '{$1=$1}1' | rofi -dmenu -p "Select your WiFi network")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test -z $SELECTEDWIFI
 | 
				
			||||||
 | 
					    notify-send "No WiFi network selected" -u low && exit
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					nmcli c u $SELECTEDWIFI
 | 
				
			||||||
@ -1,2 +1,2 @@
 | 
				
			|||||||
#!/usr/bin/env fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp
 | 
					/usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
#!/usr/bin/env fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
					grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
					set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
				
			||||||
test -z "$emoji" && notify-send "No emoji copied" && exit
 | 
					test -z "$emoji" && notify-send "No emoji copied" -u low && exit
 | 
				
			||||||
set -a emoji "copied to clipboard"
 | 
					set -a emoji "copied to clipboard"
 | 
				
			||||||
pgrep -x dunst >/dev/null && notify-send $emoji
 | 
					pgrep -x dunst >/dev/null && notify-send -u low $emoji
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user