Skip to content

Instantly share code, notes, and snippets.

View EsauPR's full-sized avatar
🏠
Working from home

Esaú Peralta EsauPR

🏠
Working from home
View GitHub Profile
@EsauPR
EsauPR / speech.sh
Created June 21, 2017 23:31
Make talk your computer
#!/bin/bash
#################################
# Speech Script by Dan Fountain #
# Modified by Pablo Castagnino #
# TalkToDanF@gmail.com #
#################################
INPUT=$*
STRINGNUM=0
@EsauPR
EsauPR / wakeon.sh
Created June 21, 2017 23:33
Un script que enciende los equipos por WOL
#!/bin/bash
#
# arrancar_equipos.sh - Un script que enciende los equipos por WOL.
#
# Este código es software libre. Puede redistribuirlo y/o modificarlo bajo los términos de la
# Licencia Pública General de GNU según es publicada por la Free Software Foundation, bien de la
# versión 2 de dicha Licencia o bien (según su elección) de cualquier versión posterior.
# Este programa se distribuye con la esperanza de que sea útil, pero SIN NINGUNA GARANTÍA, incluso
# sin la garantía MERCANTIL implícita o sin garantizar la CONVENIENCIA PARA UN PROPÓSITO PARTICULAR.
# Véase la Licencia Pública General de GNU para más detalles.
@EsauPR
EsauPR / share_wifi.cmd
Last active April 9, 2019 04:33
Share wifi connection in windows
netsh wlan set hostednetwork mode=allow ssid=NAME KEY=PASSWORD
netsh wlan start hostednetwork
@EsauPR
EsauPR / usb_boot.cmd
Created June 21, 2017 23:41
Create usb to Install windows from cmd
diskpart
list disk
select disk X
clean
create partition primary
select partition 1
active
format fs=fat32 quick
assign
exit
@EsauPR
EsauPR / grub_recovery.md
Created June 21, 2017 23:42
Ways to restore grub

Grub Recovery

From system [1]

$ mount /dev/sdaX /mnt
$ mount --bind /dev /mnt/dev
$ mount --bind /dev/pts /mnt/dev/pts
$ mount --bind /proc /mnt/proc
$ mount --bind /sys /mnt/sys
@EsauPR
EsauPR / luks.md
Created June 21, 2017 23:43
Cifrar particiones con luks

Cifrar con luks

Instalar luks

$ apt-get install cryptsetup

Cifrar la partición

@EsauPR
EsauPR / kbd_backlight.sh
Last active March 4, 2018 15:23
Enable or disable keyboard backlight
#!/bin/bash
# Time
# Locattion: /sys/devices/platform/sony-laptop/kbd_backlight_timeout
# where: 0(default)=10secs, 1=30secs, 2=60secs and 3=unlimited
path="/sys/devices/platform/sony-laptop/kbd_backlight"
if [ $(<$path) -eq 1 ]
then
newval=0
@EsauPR
EsauPR / download.js
Last active June 21, 2017 23:57
Download file from nodejs
const http = require('http');
function downloadFile(url) {
return new Promise((resolve, reject) => {
const chunks = [];
const request = http.get(url, response => {
response.on('data', chunk => {
chunks.push(chunk);
});
response.on('end', () => {
@EsauPR
EsauPR / pow1.c
Last active November 16, 2017 05:07
#include <stdio.h>
#define MOD 10000
int main(int argc, char const *argv[]) {
int N, P, result = 1;
scanf("%d %d", &N, &P);
for (int i = 0; i < P; i++) {
result = (result * (N % MOD)) % MOD;
}
@EsauPR
EsauPR / pow2.c
Last active November 16, 2017 05:09
#include <stdio.h>
#define MOD 10000
int my_pow(int N, int P) {
if (P == 0) return 1;
if (P == 1) return (N % MOD);
int temp_pow = my_pow(N, P/2);
if ((P % 2) == 0) {