Site Tools


Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
onny:notizen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
onny:notizen [2022/05/08 09:05] – [git] 46.223.162.160onny:notizen [2024/02/20 17:46] – [git] 127.0.0.1
Line 1: Line 1:
-===== ArchLinux ===== 
-==== system ==== 
-set extra capabilities for process 
-<code bash> 
-sudo setcap 'CAP_NET_BIND_SERVICE=+ep' /usr/bin/maddy 
-</code> 
-directory permissions 
-<code bash> 
-namei -l /mnt/external/audio 
-</code> 
-use acl to grant permission to files for specific user 
-<code bash> 
-setfacl -R -m u:maddy:rX /etc/ssl/example.org.crt /etc/ssl/example.org.key 
-</code> 
-pgrep get process pid by process name 
-<code bash> 
-$ pgrep sw3 
-30636 
-</code> 
-set system time 
-<code bash> 
-timedatectl set-time "2014-05-26 11:13:54" 
-</code> 
-==== packaging ==== 
-git checkout aur package 
-<code bash> 
-git clone ssh://aur@aur.archlinux.org/pkgbase.git 
-</code> 
-=== commands === 
-update checksums inplace 
-<code bash> 
-updpkgsums 
-</code> 
-building a package in a clean dev chroot, path for pacman conf ''/usr/share/devtools/pacman-extra.conf'' 
-<code bash> 
-cd <package-patch> 
-ls PKGBUILD 
-extra-x86_64-build # -c for cleaning up chroot. ~/chroot/root is a btrfs subvolume and has to be removed with btrfs! 
-extra-x86_64-build -- -I ~/packages/foobar/foobar-2-1-any.pkg.tar.xz 
-</code> 
-advanced chroot with own packages preinstalled 
-<code bash> 
-mkdir ~/chroot 
-export CHROOT=$HOME/chroot 
-mkarchroot $CHROOT/root base-devel 
-arch-nspawn $CHROOT/root pacman -Syu # updating it 
-makechrootpkg -r $CHROOT -I package-1.0-1-i686.pkg.tar.xz # -c for clean chroot  
-# repackage: makechrootpkg -r /home/onny/chroot -- -R 
-</code> 
-cheap python virtualenv 
-<code bash> 
-mkdir path 
-ln -s /usr/bin/python2 path/python 
-export PATH="$srcdir/path:$PATH" 
-</code> 
-abs deprecated, using asp 
-<code bash> 
-asp export linux 
-</code> 
-=== PKGBUILD === 
-Installation von Lizenzdateien: 
-<code bash> 
-install -D "LICENSE.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" 
-</code> 
-Installation von Systemd-Units: 
-<code bash> 
-install -Dm644 "${srcdir}/btlive.service" "${pkgdir}/usr/lib/systemd/system/btlive.service" 
-</code> 
-Installation von Docs: 
-<code bash> 
-install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md" 
-</code> 
-Installation von Tmpfiles: 
-<code bash> 
-install -Dm644 "wallace/wallace.tmpfiles.d.conf" "${pkgdir}/usr/lib/tmpfiles.d/wallace.conf" 
-</code> 
-Installation von Libs: 
-<code bash> 
-install -m644 libdouble-conversion.so.0.0.0* "${pkgdir}/usr/lib/" 
-</code> 
-do not strip binary files 
-<code> 
-options=('!strip') 
-</code> 
-Installation von ausführbare Dateien: 
-<code bash> 
-install -Dm755 shareLinkCreator "${pkgdir}/usr/bin/sharelinkcreator" 
-</code> 
-Nginx/Apache Template-Dateien: 
-<code bash> 
- if [[ -n $(which httpd 2> /dev/null) ]]; then 
-   backup=('etc/httpd/conf/extra/owncloud.conf') 
- fi 
- package(){ 
-   # install apache .conf file if apache is installed 
-   if [[ -n $(which httpd 2> /dev/null) ]]; then 
-      install -d  $pkgdir/etc/httpd/conf/extra  
-      install -m 644 $srcdir/owncloud.conf  $pkgdir/etc/httpd/conf/extra/  
-   fi 
- } 
-</code> 
-Zielname der Quelldatei ändern: 
-<code bash> 
-source=("$pkgname-$pkgver.tar.gz::https://gitlab.com/gitlab-org/gitlab-ce/repository/archive?ref=v${pkgver}") 
-</code> 
-Architekturabhängige Build-Anweisung 
-<code bash> 
- build() { 
-   cd "${srcdir}/oclHashcat" 
-   if [[ "$CARCH" = "x86_64" ]]; then 
-     make cudaHashcat64.bin 
-   else 
-     make cudaHashcat32.bin 
-   fi 
-   make nv_all 
- } 
-</code> 
-pkgver git 
-<code bash> 
- pkgver() { 
-   cd "mail" 
-   #git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g' 
-   git log -1 --format=%cd.%h --date=short|tr -d - 
- } 
-</code> 
-Common install file example 
-<code bash> 
-post_install() { 
-  mkdir /var/lib/zabbix 
-  getent group lool > /dev/null || groupadd -r lool > /dev/null 
-  getent passwd lool > /dev/null || useradd lool > /dev/null 
-  chown -R lool:lool /var/cache/loolwsd \ 
-                     /opt/lool/child-roots 
-} 
  
-post_remove() { +===== bash =====
-   userdel -rf lool +
-   groupdel lool +
-+
-</code> +
-in pkgbuild reference +
-<code bash> +
-install="libreoffice-online-bin.install" +
-</code> +
-=== aurutils === +
-install packages into build container +
-<code bash+
-arch-chroot /var/lib/aurbuild/x86_64/root pacman -S git +
-pacman --root=/var/lib/aurbuild/x86_64/root -S git +
-</code> +
-add gpg key into build container +
-<code bash> +
-sudo -u aur gpg --recv-keys EB774491D9FF06E2 +
-</code> +
-rebuild prebuild package and add to custom AUR repo +
-<code bash> +
-fakepkg webkitgtk2 +
-sudo -u aur repo-add /var/cache/pacman/aur/aur.db.tar /tmp/webkitgtk2-3:2.4.11-16-x86_64.pkg.tar.xz +
-cp /tmp/webkitgtk2-3:2.4.11-16-x86_64.pkg.tar.xz /var/cache/pacman/aur +
-</code> +
-==== bluetooth ==== +
-Example session ''bluetoothctl'' +
-<code bash> +
-# bluetoothctl  +
-[bluetooth]# default-agent  +
-[bluetooth]# scan on +
-[bluetooth]# pair 00:12:34:56:78:90 +
-[bluetooth]# connect 00:12:34:56:78:90 +
-</code>+
  
-==== usefull stuff ==== 
-pipe stderr to stdout 
-<code bash> 
-command 2>&1 >/dev/null | grep 'something' 
-</code> 
-pipe stderr and stdout both to a file 
-<code bash> 
-command &> error_log 
-</code> 
-locate pacnew files 
-<code bash> 
-find /etc -regextype posix-extended -regex ".+\.pac(new|save)" 2> /dev/null 
-</code> 
-or search entire disk 
-<code bash> 
-find / -regextype posix-extended -regex ".+\.pac(new|save)" 2> /dev/null 
-</code> 
-=== swapfile on btrfs === 
-<code bash> 
-swapfile=$(losetup -f) #free loop device 
-truncate -s 8G /swap   #create 8G sparse swap file 
-losetup $swapfile /swap #mount file to loop 
-mkswap  $swapfile 
-swapon  $swapfile 
-</code> 
-search library availability in system, print file paths 
-<code bash> 
-ldconfig -p | grep blas  
-</code> 
- 
- 
-==== systemd nspawn (container) ==== 
-<code bash> 
-pacman -S arch-install-scripts 
-btrfs subvol create /var/lib/container/archlinux-base 
-mkdir /etc/systemd/nspawn 
-pacstrap /var/lib/container/archlinux-base base base-devel 
-systemctl enable --now systemd-networkd systemd-resolved 
-systemd-nspawn --boot -nD /var/lib/machines/archlinux-nextcloudcli --template=/var/lib/container/archlinux-base 
-systemctl start systemd-nspawnd@archlinux-nextcloudcli 
-machinectl shell root@archlinux-nextcloudcli /bin/bash -c "systemctl enable --now systemd-networkd systemd-resolved"  
-</code> 
-quit / exit / kill container: Hold ''Ctrl'' press '']'' three times 
- 
-==== systemd service ==== 
-set environment 
-<file - /etc/systemd/system/piradio.service> 
-[Unit] 
-Description=PiRadio 
-After=network-online.target 
-After=bluetooth.service 
- 
-[Service] 
-Environment="XDG_RUNTIME_DIR=/run/user/1001" 
-Type=simple 
-User=piradio 
-WorkingDirectory=/usr/lib/piradio 
-ExecStartPre=/bin/sleep 5 
-ExecStart=/usr/lib/piradio/piradio 
-Restart=on-abort 
- 
-[Install] 
-WantedBy=multi-user.target 
-WantedBy=network-online.target 
-</file> 
-===== kernel ===== 
-grep kernel config running system 
-<code bahs> 
-zcat /proc/config.gz | grep VDSO 
-</code> 
-===== fish ===== 
-unset history 
-<code> 
-fish --private 
-</code> 
-===== bash ===== 
 lzma hado compression and extraction lzma hado compression and extraction
 <code bash> <code bash>
Line 331: Line 88:
 chmod +x $FILE chmod +x $FILE
 $FILE "$@" $FILE "$@"
-</code> 
-==== sed ==== 
-Mit sed inplace eine Zeile zu einer Datei hinzufügen: 
-<code bash> 
-sed -i '9i#include <algorithm>' liboffsetfinder64/vmem.cpp 
-</code> 
-add to end of file  
-<code bash> 
-sed -i -e '$aretry $@' retry.sh 
-</bash> 
-Comment out specific line matching a string 
-<code bash> 
-sudo sed -e '/pam_securetty.so/ s/^#*/#/' -i delugecontainer/etc/pam.d/login 
-</code> 
-comment out multiple lines / range 
-<code bash> 
-sed -i "28,33 s/# *//" autogen.sh 
-</code> 
-regex parse value of xml tags 
-<code bash> 
-sed -n 's/.*<id>\(.*\)<\/id>.*/\1/p' myfile.txt 
-</code> 
-delete multiple lines 
-<code bash> 
-sed -i '2,3d;5d;8d' file 
 </code> </code>
  
-insert line after match 
-<code bash> 
-sed  '/\[option\]/a Hello World' input 
-</code> 
 ==== grep ==== ==== grep ====
 regex match group regex match group
Line 384: Line 112:
 </code> </code>
  
-==== rg ==== +execute command
- +
-filter file type+
 <code bash> <code bash>
-rg GPIO_CFG_2MA -g '*.h'+fd --type f -e doc -e docx -e pdf -i gabriel -x cp --backup=t {} /tmp/gabriel/
 </code> </code>
-==== curl ==== + 
-post data+find filenames unallowed characters
 <code bash> <code bash>
-curl --data "UserId=eb8c2ec5352843d3a16ca11c26d3551c&Name=lolorollo&api_key=a5dc4e***9c9e0a***3" "https://turbotux.de/Playlists?UserId=eb8c2ec5352843d3a16ca11c26d3551c&Name=lolorollo&api_key=a5***d***9e0***3" +fd '[^A-Z a-züö@0-9._-]remote/200_Archiv/CP_Dont_Touch
-</code> +
-download and extract archive +
-<code bash> +
-curl http://wordpress.org/latest.tar.gz | tar xvz +
-</code> +
-set host header +
-<code bash> +
-torify curl --header "Host: http.pi" blog.project-insanity.org +
-</code> +
-==== tcpdump ==== +
-specific ports +
-<code bash> +
-tcpdump -i eth0 -q '(tcp port 80) or (tcp port 443)' -A +
-</code> +
-exclude specific host +
-<code bash> +
-tcpdump -i eth0 -q '(ip or ip6) and (tcp port 80) or (tcp port 443) and not host ifconfig.co' -A+
 </code> </code>
 +
 +
 ==== patching ==== ==== patching ====
 === appling === === appling ===
Line 427: Line 138:
 </code> </code>
  
 +==== xargs ====
 +
 +<code>
 +fd . | xargs -I {} rm "{}"
 +</code>
 ===== rsync ===== ===== rsync =====
 custom ssh port custom ssh port
Line 451: Line 167:
 </file> </file>
 ===== networking ===== ===== networking =====
-netcat 
-<code bash> 
-netcat -l 4444 
-</code> 
-<code bash> 
-netcat playground.pi 4444 
-</code> 
 ==== nftables ==== ==== nftables ====
 <code bash> <code bash>
Line 499: Line 208:
 iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2:22 iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2:22
 </code> </code>
-</code> 
-==== ip ==== 
-set address 
-<code bash> 
-ip address add dev usb0 172.16.42.1/24 
-ip link set usb0 up 
-</code> 
-route command example 
-<code bash> 
-ip route add 192.168.1.0/24 dev eth0 
-ip route add default via 192.168.1.1 
-</code> 
-flush addresses 
-<code bash> 
-ip addr flush dev enp8s0 
-</code> 
-remove interface 
-<code bash> 
-ip link delete br0 
-</code> 
-delete address 
-<code bash> 
-ip addr del 192.168.178.20/24 dev eth0 
-</code> 
-show only specific interface 
-<code bash> 
-ip a show wg0 
 </code> </code>
  
-change mtu 
-<code bash> 
-ip link set dev eth0 mtu 1400 
-</code> 
 ==== dnsmasq ==== ==== dnsmasq ====
 minimal hostapd and dnsmasq config minimal hostapd and dnsmasq config
Line 584: Line 262:
 compression compression
 <code bash> <code bash>
-convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf+gm convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf
 </code> </code>
 lossless merge lossless merge
Line 640: Line 318:
 </code> </code>
 ===== security ===== ===== security =====
 +
 +==== web discovery ====
 +
 +=== photon ===
 +
 +<code>
 +photon -u test.example.org
 +</code>
  
 ==== lynis ==== ==== lynis ====
Line 655: Line 341:
 ==== wfuzz ==== ==== wfuzz ====
 <code bash> <code bash>
-torify wfuzz -c --hc 404 -w /opt/wfuzz/wordlist/general/megabeast.txt http://www.leeel.de/FUZZ +wfuzz -c --hc 404 -w /opt/wfuzz/wordlist/general/megabeast.txt http://www.leeel.de/FUZZ 
-torify wfuzz -c --hc 404,403 -w /opt/wfuzz/wordlist/general/admin-panels.txt -w /opt/wfuzz/wordlist/general/extensions_common.txt http://www.leeel.de/FUZZFUZ2Z+wfuzz -c --hc 404,403 -w /opt/wfuzz/wordlist/general/admin-panels.txt -w /opt/wfuzz/wordlist/general/extensions_common.txt http://www.leeel.de/FUZZFUZ2Z
 </code> </code>
 Preparing data for LFI scan Preparing data for LFI scan
Line 671: Line 357:
     * https://github.com/maurosoria/dirsearch     * https://github.com/maurosoria/dirsearch
   * wifite wifi auditing tool   * wifite wifi auditing tool
 +
 +sec tools
 +
 +  * dirbuster
 +  * https://mitmproxy.org/
 +  * **tiger** - system sec scanner
 +  * sub domain evaluation
 +    * https://github.com/kpcyrd/sn0int
 +    * https://github.com/OWASP/Amass
 +    * subfinder (passive, external sources)
 +  * vhost scanning
 +    * https://github.com/codingo/VHostScan
 +  * bettercap - wifi network
 +  * iodine dns tunnel https://code.kryo.se/iodine/
 +  * command searchsploit in exploitdb
 +  * NixOS for Pentesting Overview https://github.com/NixOS/nixpkgs/issues/81418
  
 ===== chromium / chrome ===== ===== chromium / chrome =====
Line 678: Line 380:
 </code> </code>
 ===== docker ===== ===== docker =====
-Short example+ 
 +Pull
 <code bash> <code bash>
- sudo systemctl start docker +docker pull ubuntu:22.04 
- gpasswd -a onny docker +docker pull rootlogin/nextcloud:develop
- docker run -d -p 80:80 rootlogin/nextcloud +
- docker run -v /home/onny/projects/nextcloud-app-radio:/opt/nextcloud/apps/radio -d --name nextcloud -p 80:80 rootlogin/nextcloud+
 </code> </code>
 +
 +Run
 +<code bash>
 +docker run -td ubuntu:22.04
 +</code>
 +
 +Executing
 +<code bash>
 +docker exec -it ffffdfdfsdfsdfsfsffsdfs /bin/bash
 +</code>
 +
 +Nextcloud
 +<code bash>
 +docker run -d -p 80:80 rootlogin/nextcloud
 +docker run -v /home/onny/projects/nextcloud-app-radio:/opt/nextcloud/apps/radio -d --name nextcloud -p 80:80 rootlogin/nextcloud
 +</code>
 +
 Debugging it Debugging it
 <code bash> <code bash>
Line 690: Line 408:
  docker exec -i -t e326cbb922aa /bin/bash # exec new shell running container   docker exec -i -t e326cbb922aa /bin/bash # exec new shell running container 
 </code> </code>
 +
 Pull from repository Pull from repository
 <code> <code>
Line 700: Line 419:
  docker run -i -t e326cbb922aa /bin/bash  docker run -i -t e326cbb922aa /bin/bash
 </code> </code>
-Pull specific tagged image +
-<code bash> +
-docker pull rootlogin/nextcloud:develop +
-</code>+
 Build from Dockerfile Build from Dockerfile
 <code> <code>
Line 727: Line 443:
 docker system prune -a docker system prune -a
 </code> </code>
-docker stop all container +
-<code bash> +
-docker stop (docker ps -a -q) +
-</code>+
 prevent from auto start prevent from auto start
 +
 <code bash> <code bash>
 docker update --restart=no client-iaro_db_1 docker update --restart=no client-iaro_db_1
Line 907: Line 621:
 git remote set-url origin gitlab@http-new.pi:onny/web-wikidict.git git remote set-url origin gitlab@http-new.pi:onny/web-wikidict.git
 </code> </code>
-tagging +
-<code bash> +
-git tag -a v0.1 -m 'whackspace wordpress theme init' +
-</code>+
 merge commits from a remote repository merge commits from a remote repository
 +
 <code bash> <code bash>
 git fetch https://github.com/rfc2822/davdroid.git master git fetch https://github.com/rfc2822/davdroid.git master
Line 1036: Line 748:
 git commit --all --amend --no-edit git commit --all --amend --no-edit
 git rebase --continue git rebase --continue
 +</code>
 +
 +add co-author / co-authors to commit
 +<code bash>
 +git commit --amend
 +# Add line: Co-authored-by: name <name@example.com>
 </code> </code>
 ===== yum ===== ===== yum =====
Line 1117: Line 835:
 </code> </code>
   * check spamminess of email server: https://www.mail-tester.com/   * check spamminess of email server: https://www.mail-tester.com/
-  * manual imap login +
-openssl imaps login +
-<code> +
-openssl s_client -connect mail.sexypump.de:993 -crlf +
-A login cypherpunk cypherpunk +
-</code> +
-get quota +
-<code> +
-a GETQUOTAROOT INBOX +
-</code> +
-get msg count of folder +
-<code> +
-a LIST INBOX * +
-* LIST (\HasChildren) "." INBOX +
-* LIST (\HasNoChildren \UnMarked) "." "INBOX.Deleted Messages" +
-* LIST (\HasNoChildren \UnMarked) "." "INBOX.Sent Messages" +
-* LIST (\HasNoChildren \UnMarked \Trash) "." INBOX.Trash +
-* LIST (\HasNoChildren \UnMarked \Sent) "." INBOX.Sent +
-* LIST (\HasNoChildren \UnMarked) "." INBOX.Notes +
-* LIST (\HasNoChildren \UnMarked \Junk) "." INBOX.Junk +
-* LIST (\HasNoChildren \UnMarked \Drafts) "." INBOX.Drafts +
-* LIST (\HasNoChildren \UnMarked) "." INBOX.AntiSpam +
-a OK List completed (0.001 + 0.000 secs). +
-a SELECT INBOX +
-</code>+
 send smtp mail send smtp mail
 <code> <code>
Line 1239: Line 933:
 ngrep -q -W byline "search" host www.google.com and port 80 ngrep -q -W byline "search" host www.google.com and port 80
 </code> </code>
-  * sec 
-    * https://mitmproxy.org/ 
-    * **tiger** - system sec scanner 
-    * sub domain evaluation 
-      * https://github.com/kpcyrd/sn0int 
-      * https://github.com/OWASP/Amass 
-      * subfinder (passive, external sources) 
-    * vhost scanning 
-      * https://github.com/codingo/VHostScan 
-    * bettercap - wifi network 
-    * iodine dns tunnel https://code.kryo.se/iodine/ 
-    * command searchsploit in exploitdb 
   * sys   * sys
     * **usbtop**     * **usbtop**
Line 1331: Line 1013:
 </code> </code>
 ===== nixos ===== ===== nixos =====
 +
 apply changes to system apply changes to system
-<code bash+ 
-nixos-rebuild switch+<code> 
 +sudo nixos-rebuild switch --flake '/etc/nixos#joes-desktop' 
 +sudo nixos-rebuild boot --flake '/etc/nixos#joes-desktop' # raspi specific
 </code> </code>
 +
 update channel, rebuild and switch update channel, rebuild and switch
 +
 <code bash> <code bash>
 nixos-rebuild switch --upgrade nixos-rebuild switch --upgrade
 </code> </code>
 +
 search package search package
 +
 <code bash> <code bash>
 nix search gedit nix search gedit
 </code> </code>
 +
 nixos testing environement nixos testing environement
 +
 <code bash> <code bash>
 nix-shell -p toilet nix-shell -p toilet
 </code> </code>
 +
 install unstable package install unstable package
 +
 <code bash> <code bash>
 nix-channel --add https://nixos.org/channels/nixos-unstable unstable nix-channel --add https://nixos.org/channels/nixos-unstable unstable
Line 1353: Line 1046:
 nix-env -iA unstable.pdfarranger nix-env -iA unstable.pdfarranger
 </code> </code>
 +
 custom local repository, list packages custom local repository, list packages
 +
 <code bash> <code bash>
 nix-env -f /etc/nixos/apps -qaP '*' nix-env -f /etc/nixos/apps -qaP '*'
 </code> </code>
 +
 install package from local repo install package from local repo
 +
 <code bash> <code bash>
 nix-env -f /etc/nixos/apps -iA xerox6000-6010 nix-env -f /etc/nixos/apps -iA xerox6000-6010
 </code> </code>
 +
 package shell script package shell script
 +
 <code> <code>
   # Here we but a shell script into path, which lets us start sway.service (after importing the environment of the login shell).   # Here we but a shell script into path, which lets us start sway.service (after importing the environment of the login shell).
Line 1477: Line 1176:
  
 <code bash> <code bash>
 +cd nixpkgs
 +nix build -f ./. python310Packages.baserow
 +nix build -f ./. nodePackages.hyperpotamus
 nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { nodejs = pkgs."nodejs-10_x"; }' nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { nodejs = pkgs."nodejs-10_x"; }'
-nix-build -E 'with import /home/onny/projects/nixpkgs {}; nodePackages.hyperpotamus'+nix-build -E 'with import /home/onny/nixpkgs { }; libsForQt5.callPackage ./pkgs/applications/office/shelf/default.nix {}' 
 </code> </code>
  
Line 1488: Line 1191:
 </code> </code>
  
-quick launch program+run program
  
 <code bash> <code bash>
-nix run nixpkgs.electrum --command electrum+nix run nixpkgs#electrum -- --help 
 +nix run github:TheZombie1999/nixpkgs#upscaly 
 +nix shell nixpkgs#hash-slinger --command tlsa --create example.org
 </code> </code>
  
Line 1518: Line 1223:
  
 <code> <code>
-let  +nixpkgs.config.packageOverrides = pkgs: rec { 
- +  unstable = import unstableTarball { }; 
-  # FIXME +  opensnitch = unstable.opensnitch; 
-  unstableTarball = +};
-    fetchTarball +
-      https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +
- +
-in +
-+
- +
-  disabledModules = [ "programs/firejail.nix" ]; +
- +
-  imports = [ +
-    "${fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"}/nixos/modules/services/security/opensnitch.nix" +
-    /home/onny/projects/nixpkgs2/nixos/modules/services/networking/create_ap.nix +
-  ]; +
-  nixpkgs.config.packageOverrides = pkgs: rec { +
-    unstable = import unstableTarball { }; +
-    opensnitch = unstable.opensnitch; +
-  }+
-  #services.opensnitch.enable = true;+
 </code> </code>
  
Line 1556: Line 1244:
 </code> </code>
  
-use local src / source+overlay generate package derivation which includes custom files
  
 <code> <code>
-  src = "/home/onny/projects/linux-wifi-hotspot"; +  nwjs' = nwjs.overrideAttrs (x: { 
-  dontUnpack true+    ffmpegPrebuilt = fetchurl { 
-   +      url = "https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/${x.version}/${x.version}-linux-x64.zip"; 
-  unpackPhase = ''cp -r --no-preserve=mode $src/.'';+      sha256 "1ch14s80p4dpwkhwa831kqy4j7m55v1mdxvq0bdaa5jpd7c75mbk"
 +    }; 
 +    patchPhase = '' 
 +      cd lib 
 +      ${unzip}/bin/unzip -o $ffmpegPrebuilt 
 +      ${x.patchPhase or ""
 +    ''
 +  });
 </code> </code>
  
Line 1587: Line 1282:
           rm -r $out/share/wordpress/wp-content/themes/*           rm -r $out/share/wordpress/wp-content/themes/*
         '';         '';
 +      });
 +      foo2zjs = super.foo2zjs.overrideAttrs (oldAttrs: rec {
 +        src = builtins.fetchurl {
 +          url = "https://github.com/onny/nixpkgs/archive/foo2zjs-colorfix.tar.gz";
 +          sha256 = "0xksz2p2l0jx083hlbrh295ncb2lgsp9b8nwdig3lyinl5x";
 +        };
 +        patches = (oldAttrs.patches or []) ++ [
 +          (pkgs.fetchpatch {
 +            url = "https://raw.githubusercontent.com/onny/nixpkgs/12b6026fb0a4119e40a095aae224eaaf27098c10/pkgs/misc/drivers/foo2zjs/dell1250c-a4fix.patch";
 +            sha256 = "0lvbryw6ymh0ahwkhqsgmjimg5saa8b1xnxmyyjxrbi3l3a6flll";
 +          })
 +        ];
       });       });
     })     })
Line 1592: Line 1299:
 </code> </code>
  
-fetchpatch+fetchpatch array
  
 <code> <code>
-  patches = [ +patches = map fetchpatch 
-    ./no-hardcode-fw.diff+  /* This patch is currently necessary for the unit test suite to run correctly. 
 +   * See https://www.mail-archive.com/klee-dev@imperial.ac.uk/msg03136.html 
 +   * and https://github.com/klee/klee/pull/1458 for more information. 
 +   */ 
 +  #{ 
 +  #  name = "fix-gtest"; 
 +  #  sha256 = "F+/6videwJZz4sDF9lnV4B8lMx6W11KFJ0Q8t1qUDf4="; 
 +  #  url = "https://github.com/klee/klee/pull/1458.patch"; 
 +  #}
  
-    Support HBPL1 printers https://www.dechifro.org/hbpl/ +  This patch fixes test compile issues with glibc 2.33+
-    ./hbpl1.patch +  #{ 
- +  #  name = "fix-glibc-2.33"; 
-    Fix "Unimplemented paper codeerror for hbpl1 printers +   sha256 = "PzxqtFyLy9KF1eA9AAKg1tu+ggRdvu7leuvXifayIcc="; 
-    https://github.com/mikerr/foo2zjs/pull/+   url = "https://github.com/klee/klee/pull/1385.patch"; 
-    (fetchpatch { +  #}
-      url = "https://patch-diff.githubusercontent.com/raw/mikerr/foo2zjs/pull/2.patch"; +
-      sha256 = "0lvbryw6ymh0ahwkhqsgmjimg5saa8b1xnxmyyjxrbi3l3a6fbvy"; +
-    }+
- +
-  ];+
 </code> </code>
  
Line 1622: Line 1332:
  
 nixos-shell usage nixos-shell usage
 +
 <code bash> <code bash>
 QEMU_NET_OPTS="hostfwd=tcp::8080-:80" NIX_PATH=nixpkgs=/home/onny/projects/nixpkgs nixos-shell vm-invoiceplane.nix QEMU_NET_OPTS="hostfwd=tcp::8080-:80" NIX_PATH=nixpkgs=/home/onny/projects/nixpkgs nixos-shell vm-invoiceplane.nix
 +sudo -E QEMU_NET_OPTS="hostfwd=tcp::80-:80" NIX_PATH=nixpkgs=/home/onny/projects/nixpkgs nixos-shell vm-invoiceplane.nix
 +</code>
 +
 +systemd one shot service
 +
 +<code>
 +  # Symlink nvim user config for root user
 +  systemd.services.nvim-symlink = {
 +    script = ''
 +      if [[ ! -h "/root/.config/nvim" ]]; then
 +        ln -s "/home/onny/.config/nvim" "/root/.config/"
 +      fi
 +    '';
 +    wantedBy = [ "multi-user.target" ];
 +    serviceConfig = {
 +      Type = "oneshot";
 +    };
 +  };
 </code> </code>
 ==== packaging ==== ==== packaging ====
Line 1668: Line 1397:
 <code> <code>
 { lib { lib
-mkDerivation+stdenv
 , fetchFromGitLab , fetchFromGitLab
 , cmake , cmake
Line 1678: Line 1407:
 }: }:
  
-mkDerivation rec {+stdenv.mkDerivation rec {
   pname = "pdfmixtool";   pname = "pdfmixtool";
   version = "1.0.2";   version = "1.0.2";
Line 1908: Line 1637:
 } }
 </code> </code>
 +
 +packaging java / jar file
 +
 +<code>
 +  installPhase = ''
 +    mkdir -p $out/{bin,lib}
 +    cp ${src}/briar-desktop.jar $out/lib/
 +    makeWrapper ${openjdk}/bin/java $out/bin/briar-desktop \
 +      --add-flags "-jar $out/lib/briar-desktop.jar"
 +  '';
 +</code>
 +
 ==== nixops ==== ==== nixops ====
  
Line 1962: Line 1703:
 fatlabel /dev/sdb1 "mystick" fatlabel /dev/sdb1 "mystick"
 </code> </code>
 +
 resize extX partition resize extX partition
 +
 <code bash> <code bash>
 sfdisk -l /dev/sdb sfdisk -l /dev/sdb
Line 2047: Line 1790:
 </code> </code>
  
-===== avahi ===== +
-discover local services +
-<code bash> +
-avahi-browse --all --ignore-local --resolve --terminate +
-</code>+
 ===== curlftpfs ===== ===== curlftpfs =====
 <code bash> <code bash>
Line 2233: Line 1972:
 qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append "console=ttyAMA0 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main/" -nographic qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append "console=ttyAMA0 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main/" -nographic
 </code> </code>
 +
 +===== postgresql =====
 +
 +list all databases
 +<code bash>
 +sudo -u postgres psql
 +# \l
 +</code>
 +
 +drop database
 +<code bash>
 +sudo -u postgres psql
 +# drop database gitlabhq_production;
 +# drop database gitlabhq_production WITH (FORCE);
 +</code>
 +
 +list tables
 +<code bash>
 +sudo -u postgres psql
 +# \c gitlabhq_production
 +# \dt
 +</code>
 +
 +create and delete user
 +<code>
 +DROP ROLE gitlab;
 +CREATE USER gitlab WITH PASSWORD 'test123';
 +</code>
 +
 +grant permissions
 +<code>
 +ALTER USER gitlab SUPERUSER;
 +CREATE DATABASE gitlabhq_production OWNER gitlab;
 +ALTER DATABASE gitlabhq_production OWNER TO gitlab;
 +</code>
 +
 +dump database
 +<code>
 +pg_dump -U gitlab gitlabhq_production > /tmp/gitlab.pgsql
 +</code>
 +
 +dump all
 +<code>
 +pg_dumpall > /tmp/dump_file_name.tar
 +</code>
 +
 +import database
 +<code>
 +psql# CREATE DATABASE gitlabhq_production;
 +psql -U gitlab gitlabhq_production < gitlab.pgsql
 +</code>
 +
 +
onny/notizen.txt · Last modified: 2024/02/21 09:38 by 127.0.0.1