Skip to content

Instantly share code, notes, and snippets.

View pulketo's full-sized avatar

Pulketo pulketo

View GitHub Profile
@pulketo
pulketo / gist:b85d205441c79f17febcba113cd51b71
Created January 8, 2019 22:56
List enabled / disabled services systemctl | Listar servicios habilitados / deshabilitados de systemctl
All | Todos
systemctl list-unit-files
Enabled | Habilitados
systemctl list-unit-files | grep enabled
Disabled | Deshabilitados
systemctl list-unit-files | grep disabled
@pulketo
pulketo / gist:8b119045ee175583ff176fe3a14e39e5
Created January 9, 2019 19:53
Delete empty lines with "sed" | Borrar lineas en blanco con "sed"
cat file.in | sed '/^$/d' >file.out
#
sed -i '/^$/d' file.in.place
@pulketo
pulketo / gist:42f680cd527089c5e5c3d87fc0edc7e1
Created January 11, 2019 18:16
Palette colors fonts etc
https://mycolor.space/gradient
http://paletton.com/
@pulketo
pulketo / gist:952c8d047244e7b6fe6c4215a0993da5
Created January 14, 2019 23:18
Ajustar zona horarioa | Set / Get timezone Centos 7
REVIEW: timedatectl list-timezones
GET: timedatectl status
SET: timedatectl set-timezone America/Mexico_City
@pulketo
pulketo / gist:dd916561c367cfe5b2baac3b4d049e76
Created January 16, 2019 15:27
Cosas con docker | docker stuff
Actualizar una imagen (p.ej myssql)
docker pull mysql
docker stop my-mysql-container
docker rm my-mysql-container
docker run --name=my-mysql-container --restart=always -e MYSQL_ROOT_PASSWORD=mypwd -v /my/data/dir:/var/lib/mysql -d mysql
show current docker images running
docker ps
show last images running and stopped
remove first column
cat stuff.txt | awk '{$1=""}1' | awk '{$1=$1}1'
remove empty lines
cat stuff.txt | sed '/^$/d'
sed -i '/^$/d' stuff.txt
@pulketo
pulketo / Lubuntu, add new font | agregar font
Last active January 24, 2019 16:13
Lubuntu, add new font | agregar font
put'em on: /usr/share/fonts/truetype/
sudo fc-cache -f -v
@pulketo
pulketo / extractNumbersString.php
Created January 31, 2019 17:12 — forked from lerua83/extractNumbersString.php
PHP - Extract numbers from a string: URL: http://stackoverflow.com/questions/6278296/extract-numbers-from-a-string I want to extract the numbers from a string that contains numbers and letters like
$str = 'In My Cart : 11 12 items';
preg_match_all('!\d+!', $str, $matches);
print_r($matches);
// array holding allowed Origin domains
$allowedOrigins = array(
'(http(s)://)?(www\.)?my\-domain\.com'
);
if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN'] != '') {
foreach ($allowedOrigins as $allowedOrigin) {
if (preg_match('#' . $allowedOrigin . '#', $_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
@pulketo
pulketo / gist:2a31beaa43687612aa08eea66fc59524
Created February 19, 2019 18:00
Javascript Html Reload if back button
window.addEventListener( "pageshow", function ( event ) {
var historyTraversal = event.persisted ||
( typeof window.performance != "undefined" &&
window.performance.navigation.type === 2 );
if ( historyTraversal ) {
// Handle page restore.
window.location.reload();
}
});