This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# credits: | |
# https://stackoverflow.com/a/17794626/16157358 | |
# https://stackoverflow.com/questions/4881930/remove-the-last-line-from-a-file-in-bash | |
### NOT DONE BY ME, JUST KEEPING FOR POSTERITY | |
filename="example.txt" | |
file_size="$(stat --format=%s "$filename")" | |
trim_count="$(tail -n1 "$filename" | wc -c)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function search() { | |
$index = 0; | |
$xs = $this->Xs->find('list', [ | |
'keyField' => function() use (&$index){ | |
return $index++; | |
}, | |
'valueField' => function ($e) { | |
return ['id' => $e->id, | |
'foo' => $e->foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.col-peco-vertical-center { | |
display:inline-block; | |
vertical-align: middle; | |
} | |
</style> | |
<div class="col-peco-vertical-center"> | |
<svg viewBox="0 0 95 90" style="height: 1.5em; fill: #705898"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For the next error, install libtool | |
cc -g -Wall -Werror -I/usr/include/libnl3 -I/usr/include/libnl3 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/readline -g -O2 -lnl-3 -lnl-genl-3 -lnl-3 -lreadline -lpcap -lbfd -o dropwatch main.o lookup.o lookup_kas.o lookup_bfd.o | |
/usr/bin/ld: main.o: in function `free_netlink_msg': | |
/home/aneweraofwonder/srcs/dropwatch/src/main.c:254: undefined reference to `nlmsg_free' | |
/usr/bin/ld: main.o: in function `handle_dm_config_new_msg': | |
/home/aneweraofwonder/srcs/dropwatch/src/main.c:561: undefined reference to `genlmsg_parse' | |
/usr/bin/ld: /home/aneweraofwonder/srcs/dropwatch/src/main.c:570: undefined reference to `nla_get_u8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installing python gpio, fancontrol on archlinux arm 64 bit, aarch64 using yay | |
yay -S libgpiod | |
sudo pip install RPi.GPIO2 | |
yay -S raspberrypi-userland-aarch64-git | |
wget https://raw.githubusercontent.com/vgooz/FanControl/master/fancontrol.py | |
chmod +x fancontrol.py | |
sudo fancontrol.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
De la siguiente URL, hay que crear un key/token: | |
https://es-la.tenable.com/products/nessus/nessus-essentials | |
Después crear el contenedor: | |
docker run --name "nessus" -d -p 8834:8834 tenableofficial/nessus | |
Seguir los pasos de la web: | |
open "https://127.0.0.1:8834/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$v = "foobar.baz"; | |
$rsm = new \Doctrine\ORM\Query\ResultSetMappingBuilder($this->_em); | |
$rsm->addRootEntityFromClassMetadata(Bazar::class, 't_alias'); | |
$query = $this->_em->createNativeQuery("select * from t td where t.foo ??| :v order by id asc", $rsm); | |
$query->setParameter("v", $v); | |
$v = ["asd", "qwert"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'cause Amnesia. | |
webpack.config.js: | |
.setOutputPath('public/') | |
// public path used by the web server to access the output path | |
.setPublicPath('/') | |
assets.yaml: | |
json_manifest_path: '%kernel.project_dir%/public/manifest.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pg8000 | |
# thanks to: Sucas Venior https://stackoverflow.com/questions/58658690/retrieve-query-results-as-dict-in-sqlalchemy | |
def rows_as_dicts(cursor): | |
"""convert tuple result to dict with cursor""" | |
col_names = [i[0].decode() for i in cursor.description] | |
for row in cursor: | |
x = dict(zip(col_names, row)) | |
yield x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits to: https://github.com/peter-evans | |
# Extracted from: https://github.com/peter-evans/docker-compose-healthcheck/blob/master/docker-compose.yml | |
# TL;DR; | |
version: "2.2" | |
services: | |
foo: | |
image: an_image:tag | |
networks: |