Skip to content

Instantly share code, notes, and snippets.

View p3x-robot's full-sized avatar
🦝
LOL - opening the sources ...

patrikx3 p3x-robot

🦝
LOL - opening the sources ...
View GitHub Profile
@p3x-robot
p3x-robot / MakeOpenVPN.sh
Created March 31, 2018 12:57 — forked from laurenorsini/MakeOpenVPN.sh
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"
@p3x-robot
p3x-robot / grub.cfg
Created March 31, 2018 12:56 — forked from Pysis868/grub.cfg
My own configuration file for GRUB2 to boot various live distributions of Linux-based operating systems, along with some system tools. I tried to include a lot of sample configuration entries, even if I don't currently use them, so it may help others. Exceedingly long blog post: http://tehfishyblog.logdown.com/chips/306146-a-homemade-ultimate-bo…
# Config for GNU GRand Unified Bootloader (GRUB) (2)
# /boot/grub/grub.cfg
# or
# /boot/grub2/grub.cfg
# This grub.cfg file was created by Lance http://www.pendrivelinux.com
# Suggested Entries and the suggestor, if available, will also be noted.
# and then improved by Pysis.
@p3x-robot
p3x-robot / readme.md
Last active April 19, 2018 18:17
💺 Re-install util-linux
@p3x-robot
p3x-robot / hack-remove-decorators.js
Last active February 25, 2019 11:02
⛮ How to disable the remove Angular decorators @ngtools/webpack mess
const fs = require('fs');
const cwd = process.cwd();
const hackPath = `${cwd}/node_modules/@ngtools/webpack/src`
const hackFileName = `${hackPath}/angular_compiler_plugin.js`
const hackFileNameHacked = `${hackFileName}.hacked`
const log = '@ngtool/webpack angular decorators remove'
const hack = () => {
if (!fs.existsSync(hackFileNameHacked)) {
const problemCode = fs.readFileSync(hackFileName).toString('utf-8').split('\n');
@p3x-robot
p3x-robot / linux-cpu-temperature-speed.sh
Last active October 8, 2019 02:10
🌡️LINUX, it shows your temperature and the CPU speed (I use Debian and Ubuntu).
#!/bin/bash
# Debian
# sudo apt install lm-sensors bc linux-cpupower
# Ubuntu
# probably is https://packages.ubuntu.com/search?suite=xenial&section=all&arch=any&keywords=cpupower&searchon=contents
# but you might to have a specific kernel linux-tools-common
# sudo apt install lm-sensors bc linux-tools-common
# Then you go this:
@p3x-robot
p3x-robot / extract-clonzilla.sh
Last active March 1, 2021 18:09
🖴 clonezilla restore files from image
#!/usr/bin/env bash
# http://blog.christosoft.de/2012/05/mount-clonezilla-image-to-restore-single-file-browse/
# ./extract-clonzilla /media/patrikx3/SEAGATE-450GB/restore/image.img '/media/patrikx3/SEAGATE-450GB/backup/2017-05-21-17-img/sda1.ext4-ptcl-img.gz.*'
# $1 = destination - full path eg /media/clonzilla/image.img
# $2 = source = '/media/backup/date/sda1.ext4-ptcl-img.gz.*' (import ' in the file, since * is needed!)
echo DESTINATION: $1
echo SOURCE: $2
@p3x-robot
p3x-robot / ObservableCreate.ts
Created May 10, 2017 13:28
ObservableCreate.ts
// http://stackoverflow.com/questions/42884746/reactivex-observable-to-trigger-when-i-want-to/42902431#42902431
const obs = Observable.create(async (obs : any ) => {
const newInfo = async () => {
return this.http.get(`http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&cache=${new Date().getTime()}`).toPromise();
}
obs.next(await newInfo());
setInterval(async () => {
obs.next(await newInfo());
console.log('update');
}, 10000)
@p3x-robot
p3x-robot / mongodb-replicate.js
Last active April 17, 2018 18:00
MongoDB replicate
db.financialdocuments.insertMany(
db.financialdocuments.find(
{},
{'_id': false}
)
);
mongoose.Schema.prototype._originalDefaultOptions = mongoose.Schema.prototype.defaultOptions;
mongoose.Schema.prototype.defaultOptions = function(options) {
if (options === undefined) {
options = {};
}
options.timestamps = true;
return this._originalDefaultOptions.apply(this._originalDefaultOptions, arguments);
}