1 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
2 |
DENIED
|
moderate
|
App\Entity\EntryComment {#1366
+user: Proxies\__CG__\App\Entity\User {#1378 …}
+entry: App\Entity\Entry {#1810 …}
+magazine: App\Entity\Magazine {#313
+icon: Proxies\__CG__\App\Entity\Image {#294 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#323
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#285 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#281 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#270 …}
+entries: Doctrine\ORM\PersistentCollection {#228 …}
+posts: Doctrine\ORM\PersistentCollection {#186 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#248 …}
+bans: Doctrine\ORM\PersistentCollection {#165 …}
+reports: Doctrine\ORM\PersistentCollection {#151 …}
+badges: Doctrine\ORM\PersistentCollection {#129 …}
+logs: Doctrine\ORM\PersistentCollection {#119 …}
+awards: Doctrine\ORM\PersistentCollection {#108 …}
+categories: Doctrine\ORM\PersistentCollection {#95 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#317
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#316
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+parent: Proxies\__CG__\App\Entity\EntryComment {#2356 …}
+root: Proxies\__CG__\App\Entity\EntryComment {#2476 …}
+body: """
I assume you mean “lookup”, as import doesn’t really make much sense.\n
\n
I’m currently using this with wofi, though I’ll eventually rewrite it as anyrun plugin, which provides a bit more control:\n
\n
```\n
\n
<span style="color:#323232;">#!/usr/bin/env python3\n
</span><span style="color:#323232;">from argparse import ArgumentParser\n
</span><span style="color:#323232;">import subprocess\n
</span><span style="color:#323232;">import json\n
</span><span style="color:#323232;">import os\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">ssh_config_file = "~/.ssh/config"\n
</span><span style="color:#323232;">ssh_known_hosts_file = "~/.ssh/known_hosts"\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a list of all hosts\n
</span><span style="color:#323232;">def get_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_config_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> # Ignore wildcards\n
</span><span style="color:#323232;"> if line.startswith('Host ') and not '*' in line:\n
</span><span style="color:#323232;"> for host in line.split()[1:]:\n
</span><span style="color:#323232;"> hosts.append(host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">def get_known_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_known_hosts_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> host_entry = line.partition(" ")[0]\n
</span><span style="color:#323232;"> hosts.append(host_entry.partition(",")[0])\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a newline seperated UFT-8 encoded string of all ssh hosts\n
</span><span style="color:#323232;">def parse_hosts(hosts):\n
</span><span style="color:#323232;"> return "n".join(hosts).encode("UTF-8")\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Executes wofi with the given input string\n
</span><span style="color:#323232;">def show_wofi(command, hosts):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)\n
</span><span style="color:#323232;"> ret = process.communicate(input=hosts)\n
</span><span style="color:#323232;"> host, rest = ret\n
</span><span style="color:#323232;"> return host\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Switches the focus to the given id\n
</span><span style="color:#323232;">def ssh_to_host(host, terminal, ssh_command):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if "]:" in host:\n
</span><span style="color:#323232;"> host, port = host[1:].split("]:")\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host} -p {port}'".format(terminal=terminal, ssh_command=ssh_command, host=host, port=port)\n
</span><span style="color:#323232;"> else:\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host}'".format(terminal=terminal, ssh_command=ssh_command, host=host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Entry point\n
</span><span style="color:#323232;">if __name__ == "__main__":\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parser = ArgumentParser(description="Wofi based ssh launcher")\n
</span><span style="color:#323232;"> parser.add_argument("terminal", help='Terminal command to use')\n
</span><span style="color:#323232;"> parser.add_argument("--ssh-command", dest='ssh_command', default='ssh', help='ssh command to use (default=ssh)')\n
</span><span style="color:#323232;"> parser.add_argument("--mode", dest='mode', default='known_hosts', help='where to read from (default=known_hosts)')\n
</span><span style="color:#323232;"> parser.add_argument("--command", default='wofi -p "SSH hosts: " -d -i --hide-scroll', help='launcher command to use')\n
</span><span style="color:#323232;"> args = parser.parse_args()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if (args.mode == "config"):\n
</span><span style="color:#323232;"> hosts = get_hosts()\n
</span><span style="color:#323232;"> elif (args.mode == "known_hosts"):\n
</span><span style="color:#323232;"> hosts = get_known_hosts()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parsed_hosts = parse_hosts(hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected = show_wofi(args.command, parsed_hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected_host = selected.decode('utf-8').rstrip()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if selected_host != "":\n
</span><span style="color:#323232;"> ssh_to_host(selected_host, args.terminal, args.ssh_command)\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1699900856 {#1605
date: 2023-11-13 19:40:56.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@Oha@lemmy.ohaa.xyz"
"@heartsofwar@lemmy.world"
"@aard@kyu.de"
]
+children: Doctrine\ORM\PersistentCollection {#2355 …}
+nested: Doctrine\ORM\PersistentCollection {#2167 …}
+votes: Doctrine\ORM\PersistentCollection {#2424 …}
+reports: Doctrine\ORM\PersistentCollection {#2440 …}
+favourites: Doctrine\ORM\PersistentCollection {#2490 …}
+notifications: Doctrine\ORM\PersistentCollection {#2409 …}
-id: 120575
-bodyTs: "'-8':151,168,363 '/.ssh/config':51 '/.ssh/known_hosts':56 '/usr/bin/env':36 '0':133,136 '1':96,220 'anyrun':28 'arg':331,333 'argpars':39 'args.command':356 'args.mode':335,341 'args.ssh':374 'args.terminal':373 'argument':273,281,298,314 'argumentpars':41,266 'assum':2 'base':269 'bit':33 'command':179,183,213,222,225,233,235,241,244,250,252,257,277,284,287,292,315,328,375 'config':49,71,336 'content':75,80,122,127 'control':35 'current':16 'd':321 'def':63,108,158,176,206 'default':288,295,302,310,316 'descript':267 'dest':285,300 'doesn':8 'duplic':100,138 'elif':340 'els':240 'encod':152,166 'entri':101,131,139,260 'eventu':24 'execut':169 'f':74,121 'f.readlines':76,123 'file':50,55,72,119 'focus':201 'format':229,246 'get':64,109,338,345 'given':173,204 'help':275,290,305,326 'hide':324 'hide-scrol':323 'host':54,62,65,66,87,93,98,102,105,107,111,112,118,130,140,143,145,157,160,161,165,180,193,194,198,209,210,216,217,219,226,236,237,245,253,254,304,312,320,337,339,343,344,347,349,351,352,358,360,367,370,372 'host_entry.partition':135 'hosts.append':97,134 'id':205 'ignor':83 'import':7,40,42,44,46 'input':174,192 'join':164 'json':45 'known':53,110,117,303,311,342,346 'launcher':271,327 'line':78,81,91,125,128 'line.lstrip':82,129 'line.partition':132 'line.split':95 'line.startswith':86 'list':59 'll':23 'lookup':5 'm':15 'main':264 'make':11 'mean':4 'mode':299,301 'much':12 'n':163 'name':263 'newlin':148 'open':68,114 'os':47 'os.path.expanduser':69,115 'p':227,318 'pars':159,348,350,357 'parser':265 'parser.add':272,280,297,313 'parser.parse':332 'plugin':29 'point':261 'port':218,228,238,239 'process':181,255 'process.communicate':191 'provid':31 'python3':37 'read':308 'realli':10 'remov':99,137 'rest':195 'ret':190,196 'return':57,106,144,146,162,197 'rewrit':25 'rstrip':364 'scroll':325 'select':353,359,366,371 'selected.decode':361 'sens':13 'seper':149 'set':104,142 'shell':184,258 'show':177,354 'sort':103,141 'split':221 'ssh':48,52,70,116,156,207,212,224,232,234,243,249,251,270,283,286,289,291,296,319,368 'ssh-command':282 'stdin':186 'stdout':188 'string':153,175 'subprocess':43 'subprocess.pipe':187,189 'subprocess.popen':182,256 'switch':199 'termin':211,223,230,231,242,247,248,274,276 'though':21 'true':185,259 'uft':150 'use':17,279,294,330 'utf':167,362 'wildcard':84 'wofi':20,170,178,268,317,355"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kyu.de/comment/2226561"
+editedAt: null
+createdAt: DateTimeImmutable @1699900856 {#1945
date: 2023-11-13 19:40:56.0 +01:00
}
} |
|
Show voter details
|
3 |
DENIED
|
edit
|
App\Entity\EntryComment {#1366
+user: Proxies\__CG__\App\Entity\User {#1378 …}
+entry: App\Entity\Entry {#1810 …}
+magazine: App\Entity\Magazine {#313
+icon: Proxies\__CG__\App\Entity\Image {#294 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#323
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#285 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#281 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#270 …}
+entries: Doctrine\ORM\PersistentCollection {#228 …}
+posts: Doctrine\ORM\PersistentCollection {#186 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#248 …}
+bans: Doctrine\ORM\PersistentCollection {#165 …}
+reports: Doctrine\ORM\PersistentCollection {#151 …}
+badges: Doctrine\ORM\PersistentCollection {#129 …}
+logs: Doctrine\ORM\PersistentCollection {#119 …}
+awards: Doctrine\ORM\PersistentCollection {#108 …}
+categories: Doctrine\ORM\PersistentCollection {#95 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#317
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#316
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+parent: Proxies\__CG__\App\Entity\EntryComment {#2356 …}
+root: Proxies\__CG__\App\Entity\EntryComment {#2476 …}
+body: """
I assume you mean “lookup”, as import doesn’t really make much sense.\n
\n
I’m currently using this with wofi, though I’ll eventually rewrite it as anyrun plugin, which provides a bit more control:\n
\n
```\n
\n
<span style="color:#323232;">#!/usr/bin/env python3\n
</span><span style="color:#323232;">from argparse import ArgumentParser\n
</span><span style="color:#323232;">import subprocess\n
</span><span style="color:#323232;">import json\n
</span><span style="color:#323232;">import os\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">ssh_config_file = "~/.ssh/config"\n
</span><span style="color:#323232;">ssh_known_hosts_file = "~/.ssh/known_hosts"\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a list of all hosts\n
</span><span style="color:#323232;">def get_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_config_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> # Ignore wildcards\n
</span><span style="color:#323232;"> if line.startswith('Host ') and not '*' in line:\n
</span><span style="color:#323232;"> for host in line.split()[1:]:\n
</span><span style="color:#323232;"> hosts.append(host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">def get_known_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_known_hosts_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> host_entry = line.partition(" ")[0]\n
</span><span style="color:#323232;"> hosts.append(host_entry.partition(",")[0])\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a newline seperated UFT-8 encoded string of all ssh hosts\n
</span><span style="color:#323232;">def parse_hosts(hosts):\n
</span><span style="color:#323232;"> return "n".join(hosts).encode("UTF-8")\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Executes wofi with the given input string\n
</span><span style="color:#323232;">def show_wofi(command, hosts):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)\n
</span><span style="color:#323232;"> ret = process.communicate(input=hosts)\n
</span><span style="color:#323232;"> host, rest = ret\n
</span><span style="color:#323232;"> return host\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Switches the focus to the given id\n
</span><span style="color:#323232;">def ssh_to_host(host, terminal, ssh_command):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if "]:" in host:\n
</span><span style="color:#323232;"> host, port = host[1:].split("]:")\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host} -p {port}'".format(terminal=terminal, ssh_command=ssh_command, host=host, port=port)\n
</span><span style="color:#323232;"> else:\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host}'".format(terminal=terminal, ssh_command=ssh_command, host=host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Entry point\n
</span><span style="color:#323232;">if __name__ == "__main__":\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parser = ArgumentParser(description="Wofi based ssh launcher")\n
</span><span style="color:#323232;"> parser.add_argument("terminal", help='Terminal command to use')\n
</span><span style="color:#323232;"> parser.add_argument("--ssh-command", dest='ssh_command', default='ssh', help='ssh command to use (default=ssh)')\n
</span><span style="color:#323232;"> parser.add_argument("--mode", dest='mode', default='known_hosts', help='where to read from (default=known_hosts)')\n
</span><span style="color:#323232;"> parser.add_argument("--command", default='wofi -p "SSH hosts: " -d -i --hide-scroll', help='launcher command to use')\n
</span><span style="color:#323232;"> args = parser.parse_args()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if (args.mode == "config"):\n
</span><span style="color:#323232;"> hosts = get_hosts()\n
</span><span style="color:#323232;"> elif (args.mode == "known_hosts"):\n
</span><span style="color:#323232;"> hosts = get_known_hosts()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parsed_hosts = parse_hosts(hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected = show_wofi(args.command, parsed_hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected_host = selected.decode('utf-8').rstrip()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if selected_host != "":\n
</span><span style="color:#323232;"> ssh_to_host(selected_host, args.terminal, args.ssh_command)\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1699900856 {#1605
date: 2023-11-13 19:40:56.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@Oha@lemmy.ohaa.xyz"
"@heartsofwar@lemmy.world"
"@aard@kyu.de"
]
+children: Doctrine\ORM\PersistentCollection {#2355 …}
+nested: Doctrine\ORM\PersistentCollection {#2167 …}
+votes: Doctrine\ORM\PersistentCollection {#2424 …}
+reports: Doctrine\ORM\PersistentCollection {#2440 …}
+favourites: Doctrine\ORM\PersistentCollection {#2490 …}
+notifications: Doctrine\ORM\PersistentCollection {#2409 …}
-id: 120575
-bodyTs: "'-8':151,168,363 '/.ssh/config':51 '/.ssh/known_hosts':56 '/usr/bin/env':36 '0':133,136 '1':96,220 'anyrun':28 'arg':331,333 'argpars':39 'args.command':356 'args.mode':335,341 'args.ssh':374 'args.terminal':373 'argument':273,281,298,314 'argumentpars':41,266 'assum':2 'base':269 'bit':33 'command':179,183,213,222,225,233,235,241,244,250,252,257,277,284,287,292,315,328,375 'config':49,71,336 'content':75,80,122,127 'control':35 'current':16 'd':321 'def':63,108,158,176,206 'default':288,295,302,310,316 'descript':267 'dest':285,300 'doesn':8 'duplic':100,138 'elif':340 'els':240 'encod':152,166 'entri':101,131,139,260 'eventu':24 'execut':169 'f':74,121 'f.readlines':76,123 'file':50,55,72,119 'focus':201 'format':229,246 'get':64,109,338,345 'given':173,204 'help':275,290,305,326 'hide':324 'hide-scrol':323 'host':54,62,65,66,87,93,98,102,105,107,111,112,118,130,140,143,145,157,160,161,165,180,193,194,198,209,210,216,217,219,226,236,237,245,253,254,304,312,320,337,339,343,344,347,349,351,352,358,360,367,370,372 'host_entry.partition':135 'hosts.append':97,134 'id':205 'ignor':83 'import':7,40,42,44,46 'input':174,192 'join':164 'json':45 'known':53,110,117,303,311,342,346 'launcher':271,327 'line':78,81,91,125,128 'line.lstrip':82,129 'line.partition':132 'line.split':95 'line.startswith':86 'list':59 'll':23 'lookup':5 'm':15 'main':264 'make':11 'mean':4 'mode':299,301 'much':12 'n':163 'name':263 'newlin':148 'open':68,114 'os':47 'os.path.expanduser':69,115 'p':227,318 'pars':159,348,350,357 'parser':265 'parser.add':272,280,297,313 'parser.parse':332 'plugin':29 'point':261 'port':218,228,238,239 'process':181,255 'process.communicate':191 'provid':31 'python3':37 'read':308 'realli':10 'remov':99,137 'rest':195 'ret':190,196 'return':57,106,144,146,162,197 'rewrit':25 'rstrip':364 'scroll':325 'select':353,359,366,371 'selected.decode':361 'sens':13 'seper':149 'set':104,142 'shell':184,258 'show':177,354 'sort':103,141 'split':221 'ssh':48,52,70,116,156,207,212,224,232,234,243,249,251,270,283,286,289,291,296,319,368 'ssh-command':282 'stdin':186 'stdout':188 'string':153,175 'subprocess':43 'subprocess.pipe':187,189 'subprocess.popen':182,256 'switch':199 'termin':211,223,230,231,242,247,248,274,276 'though':21 'true':185,259 'uft':150 'use':17,279,294,330 'utf':167,362 'wildcard':84 'wofi':20,170,178,268,317,355"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kyu.de/comment/2226561"
+editedAt: null
+createdAt: DateTimeImmutable @1699900856 {#1945
date: 2023-11-13 19:40:56.0 +01:00
}
} |
|
Show voter details
|
4 |
DENIED
|
moderate
|
App\Entity\EntryComment {#1366
+user: Proxies\__CG__\App\Entity\User {#1378 …}
+entry: App\Entity\Entry {#1810 …}
+magazine: App\Entity\Magazine {#313
+icon: Proxies\__CG__\App\Entity\Image {#294 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#323
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#285 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#281 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#270 …}
+entries: Doctrine\ORM\PersistentCollection {#228 …}
+posts: Doctrine\ORM\PersistentCollection {#186 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#248 …}
+bans: Doctrine\ORM\PersistentCollection {#165 …}
+reports: Doctrine\ORM\PersistentCollection {#151 …}
+badges: Doctrine\ORM\PersistentCollection {#129 …}
+logs: Doctrine\ORM\PersistentCollection {#119 …}
+awards: Doctrine\ORM\PersistentCollection {#108 …}
+categories: Doctrine\ORM\PersistentCollection {#95 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#317
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#316
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+parent: Proxies\__CG__\App\Entity\EntryComment {#2356 …}
+root: Proxies\__CG__\App\Entity\EntryComment {#2476 …}
+body: """
I assume you mean “lookup”, as import doesn’t really make much sense.\n
\n
I’m currently using this with wofi, though I’ll eventually rewrite it as anyrun plugin, which provides a bit more control:\n
\n
```\n
\n
<span style="color:#323232;">#!/usr/bin/env python3\n
</span><span style="color:#323232;">from argparse import ArgumentParser\n
</span><span style="color:#323232;">import subprocess\n
</span><span style="color:#323232;">import json\n
</span><span style="color:#323232;">import os\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">ssh_config_file = "~/.ssh/config"\n
</span><span style="color:#323232;">ssh_known_hosts_file = "~/.ssh/known_hosts"\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a list of all hosts\n
</span><span style="color:#323232;">def get_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_config_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> # Ignore wildcards\n
</span><span style="color:#323232;"> if line.startswith('Host ') and not '*' in line:\n
</span><span style="color:#323232;"> for host in line.split()[1:]:\n
</span><span style="color:#323232;"> hosts.append(host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;">def get_known_hosts():\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> hosts = []\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> with open(os.path.expanduser(ssh_known_hosts_file)) as f:\n
</span><span style="color:#323232;"> content = f.readlines()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> for line in content:\n
</span><span style="color:#323232;"> line = line.lstrip()\n
</span><span style="color:#323232;"> host_entry = line.partition(" ")[0]\n
</span><span style="color:#323232;"> hosts.append(host_entry.partition(",")[0])\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> # Removes duplicate entries\n
</span><span style="color:#323232;"> hosts = sorted(set(hosts))\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> return hosts\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Returns a newline seperated UFT-8 encoded string of all ssh hosts\n
</span><span style="color:#323232;">def parse_hosts(hosts):\n
</span><span style="color:#323232;"> return "n".join(hosts).encode("UTF-8")\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Executes wofi with the given input string\n
</span><span style="color:#323232;">def show_wofi(command, hosts):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)\n
</span><span style="color:#323232;"> ret = process.communicate(input=hosts)\n
</span><span style="color:#323232;"> host, rest = ret\n
</span><span style="color:#323232;"> return host\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Switches the focus to the given id\n
</span><span style="color:#323232;">def ssh_to_host(host, terminal, ssh_command):\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if "]:" in host:\n
</span><span style="color:#323232;"> host, port = host[1:].split("]:")\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host} -p {port}'".format(terminal=terminal, ssh_command=ssh_command, host=host, port=port)\n
</span><span style="color:#323232;"> else:\n
</span><span style="color:#323232;"> command = "{terminal} '{ssh_command} {host}'".format(terminal=terminal, ssh_command=ssh_command, host=host)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> process = subprocess.Popen(command,shell=True)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"># Entry point\n
</span><span style="color:#323232;">if __name__ == "__main__":\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parser = ArgumentParser(description="Wofi based ssh launcher")\n
</span><span style="color:#323232;"> parser.add_argument("terminal", help='Terminal command to use')\n
</span><span style="color:#323232;"> parser.add_argument("--ssh-command", dest='ssh_command', default='ssh', help='ssh command to use (default=ssh)')\n
</span><span style="color:#323232;"> parser.add_argument("--mode", dest='mode', default='known_hosts', help='where to read from (default=known_hosts)')\n
</span><span style="color:#323232;"> parser.add_argument("--command", default='wofi -p "SSH hosts: " -d -i --hide-scroll', help='launcher command to use')\n
</span><span style="color:#323232;"> args = parser.parse_args()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if (args.mode == "config"):\n
</span><span style="color:#323232;"> hosts = get_hosts()\n
</span><span style="color:#323232;"> elif (args.mode == "known_hosts"):\n
</span><span style="color:#323232;"> hosts = get_known_hosts()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> parsed_hosts = parse_hosts(hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected = show_wofi(args.command, parsed_hosts)\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> selected_host = selected.decode('utf-8').rstrip()\n
</span><span style="color:#323232;"> \n
</span><span style="color:#323232;"> if selected_host != "":\n
</span><span style="color:#323232;"> ssh_to_host(selected_host, args.terminal, args.ssh_command)\n
</span>\n
```
"""
+lang: "en"
+isAdult: false
+favouriteCount: 3
+score: 0
+lastActive: DateTime @1699900856 {#1605
date: 2023-11-13 19:40:56.0 +01:00
}
+ip: null
+tags: [
"323232"
]
+mentions: [
"@Oha@lemmy.ohaa.xyz"
"@heartsofwar@lemmy.world"
"@aard@kyu.de"
]
+children: Doctrine\ORM\PersistentCollection {#2355 …}
+nested: Doctrine\ORM\PersistentCollection {#2167 …}
+votes: Doctrine\ORM\PersistentCollection {#2424 …}
+reports: Doctrine\ORM\PersistentCollection {#2440 …}
+favourites: Doctrine\ORM\PersistentCollection {#2490 …}
+notifications: Doctrine\ORM\PersistentCollection {#2409 …}
-id: 120575
-bodyTs: "'-8':151,168,363 '/.ssh/config':51 '/.ssh/known_hosts':56 '/usr/bin/env':36 '0':133,136 '1':96,220 'anyrun':28 'arg':331,333 'argpars':39 'args.command':356 'args.mode':335,341 'args.ssh':374 'args.terminal':373 'argument':273,281,298,314 'argumentpars':41,266 'assum':2 'base':269 'bit':33 'command':179,183,213,222,225,233,235,241,244,250,252,257,277,284,287,292,315,328,375 'config':49,71,336 'content':75,80,122,127 'control':35 'current':16 'd':321 'def':63,108,158,176,206 'default':288,295,302,310,316 'descript':267 'dest':285,300 'doesn':8 'duplic':100,138 'elif':340 'els':240 'encod':152,166 'entri':101,131,139,260 'eventu':24 'execut':169 'f':74,121 'f.readlines':76,123 'file':50,55,72,119 'focus':201 'format':229,246 'get':64,109,338,345 'given':173,204 'help':275,290,305,326 'hide':324 'hide-scrol':323 'host':54,62,65,66,87,93,98,102,105,107,111,112,118,130,140,143,145,157,160,161,165,180,193,194,198,209,210,216,217,219,226,236,237,245,253,254,304,312,320,337,339,343,344,347,349,351,352,358,360,367,370,372 'host_entry.partition':135 'hosts.append':97,134 'id':205 'ignor':83 'import':7,40,42,44,46 'input':174,192 'join':164 'json':45 'known':53,110,117,303,311,342,346 'launcher':271,327 'line':78,81,91,125,128 'line.lstrip':82,129 'line.partition':132 'line.split':95 'line.startswith':86 'list':59 'll':23 'lookup':5 'm':15 'main':264 'make':11 'mean':4 'mode':299,301 'much':12 'n':163 'name':263 'newlin':148 'open':68,114 'os':47 'os.path.expanduser':69,115 'p':227,318 'pars':159,348,350,357 'parser':265 'parser.add':272,280,297,313 'parser.parse':332 'plugin':29 'point':261 'port':218,228,238,239 'process':181,255 'process.communicate':191 'provid':31 'python3':37 'read':308 'realli':10 'remov':99,137 'rest':195 'ret':190,196 'return':57,106,144,146,162,197 'rewrit':25 'rstrip':364 'scroll':325 'select':353,359,366,371 'selected.decode':361 'sens':13 'seper':149 'set':104,142 'shell':184,258 'show':177,354 'sort':103,141 'split':221 'ssh':48,52,70,116,156,207,212,224,232,234,243,249,251,270,283,286,289,291,296,319,368 'ssh-command':282 'stdin':186 'stdout':188 'string':153,175 'subprocess':43 'subprocess.pipe':187,189 'subprocess.popen':182,256 'switch':199 'termin':211,223,230,231,242,247,248,274,276 'though':21 'true':185,259 'uft':150 'use':17,279,294,330 'utf':167,362 'wildcard':84 'wofi':20,170,178,268,317,355"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://kyu.de/comment/2226561"
+editedAt: null
+createdAt: DateTimeImmutable @1699900856 {#1945
date: 2023-11-13 19:40:56.0 +01:00
}
} |
|
Show voter details
|
5 |
DENIED
|
edit
|
App\Entity\Magazine {#313
+icon: Proxies\__CG__\App\Entity\Image {#294 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#323
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#285 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#281 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#270 …}
+entries: Doctrine\ORM\PersistentCollection {#228 …}
+posts: Doctrine\ORM\PersistentCollection {#186 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#248 …}
+bans: Doctrine\ORM\PersistentCollection {#165 …}
+reports: Doctrine\ORM\PersistentCollection {#151 …}
+badges: Doctrine\ORM\PersistentCollection {#129 …}
+logs: Doctrine\ORM\PersistentCollection {#119 …}
+awards: Doctrine\ORM\PersistentCollection {#108 …}
+categories: Doctrine\ORM\PersistentCollection {#95 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#317
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#316
date: 2023-11-02 13:51:08.0 +01:00
}
} |
|
Show voter details
|