Skip to content

Instantly share code, notes, and snippets.

View franga2000's full-sized avatar

Miha Frangež franga2000

View GitHub Profile
@franga2000
franga2000 / time.js
Last active December 19, 2015 11:56
Functions to process time and time zones
//Get UTC/GMT Offset
new Date().getTimezoneOffset() / -60; /* Type: integer */
//Get timezone offset string: GMT, GMT+01:00, GMT-01:30
function getTimeZoneString() {
var num = new Date().getTimezoneOffset();
if (num === 0) {
return "GMT";
} else {
var hours = Math.floor(num / 60);
@franga2000
franga2000 / install.sh
Last active May 12, 2020 23:55
1-line install scripts
# Wordpress
wget https://wordpress.org/latest.tar.gz && tar xzf latest.tar.gz && mv wordpress/* . && rmdir wordpress && rm latest.tar.gz
# Wordpress Slovenian
wget https://sl.wordpress.org/latest-sl_SI.tar.gz && tar xzf latest-sl_SI.tar.gz && mv wordpress/* . && rmdir wordpress && rm latest-sl_SI.tar.gz
# Codiad (VERSIONED!!!!)
wget https://github.com/Codiad/Codiad/archive/v.2.7.5.tar.gz && tar xzf v.*.tar.gz && mv Codiad-v.*/* . && rm -r Codiad-v.*/ && rm v.*.tar.gz
# MediaWiki (VERSIONED!!!!)
wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.0.tar.gz && tar xzf mediawiki-*.tar.gz && mv mediawiki-*/* . && rmdir mediawiki-*/ && rm mediawiki-*.tar.gz
# Flarum
composer create-project flarum/flarum . --stability=beta
@franga2000
franga2000 / Ubuntu on Acer Aspire Switch 10.md
Last active October 31, 2024 14:59
Ubuntu on Acer Aspire Switch 10

Ubuntu on Acer Aspire Switch

The problem

What's the problem with this tablet? Why can't I just insert the USB and mash F12 until it boots? The tablet is made to run Windows 8.1 and Windows 8.1 only. Some absolute genius at Acer decided to put a 32-bit UEFI on a 64-bit system, which no reasonable Linux distro supports out-of-the-box.

NOTE: This guide focuses on installing Ubuntu alongside Windows. If you're trying to replace Windows, then I assume you know enough about Linux to know which parts to change.

What works:

  • Keyboard
@franga2000
franga2000 / Compiling a custom kernel.md
Last active January 7, 2024 08:39
Compiling a custom Linux kernel from source

#Compiling a custom Linux kernel

# Install required tools
sudo apt-get install ncurses-dev
# Download Linux source
sudo apt-get install linux-source
cd /usr/src/
# Extract Linux source
tar xf linux-source-*.tar.xz
cd linux-source-*/
@franga2000
franga2000 / Kali Linux on Acer Aspire Switch 10.md
Last active April 6, 2023 01:28
Kali Linux on Acer Aspire Switch 10

#Kali Linux on Acer Aspire Switch ##The problem What's the problem with this tablet? Why can't I just insert the USB and mash F12 until it boots? The tablet is made to run Windows 8.1 and Windows 8.1 only. Because of the stupidity that is UEFI (specifically it's "Safe boot" feature) we can't just boot from any USB stick we want. Also, because someone thought putting a 32-bit UEFI on a 64-bit system was a good idea.

NOTE: This guide focuses on installing Kali alongside Windows. If you're trying to replace Windows, then I assume you know enough about Linux to know which parts to change.

##Requirements Before you start, there's a few things you need:

@franga2000
franga2000 / Ultimate home server guide.md
Created August 26, 2015 19:17
Ultimate home server

Ultimate home server 2015

#Setup services It's best to run these commands in a folder you can later delete, since some of them generate temporary files. ##Samba Firts, you have to open the following ports:

  • netbios-ns - 137/tcp
  • netbios-dgm - 138/tcp
  • netbios-ssn - 139/tcp
@franga2000
franga2000 / networking.sh
Created January 28, 2016 17:13
Bash cheat sheet
# Get interface's MAC address
# $INTERFACE : Interface name (e.g. wlan0)
$(cat /sys/class/net/$INTERFACE/address)
@franga2000
franga2000 / GNOME 3 post-install.sh
Last active August 23, 2016 14:18
GNOME 3 post-install script
#!/bin/bash
# Set up .bashrc
cat >> ~/.bashrc <<EOL
# BEGIN franga2000's .bashrc stuff & things
# Aliases
alias ll='ls -alh'
alias l='ls -CF'
alias du='du -h'
@franga2000
franga2000 / Xiaomi YI.md
Last active May 14, 2024 20:17
Xiaomi Yi

Xiaomi Yi camera

General info

  • OS: Buildroot
  • CPU: ARMv6-compatible processor rev 5 (v6l)
  • BogoMIPS: 524.28
  • Memory: 37MB

The root filesystem is rootfs, which is stored in memory and therefore wiped on reboot. The Micro SD card is mounted at /tmp/fuse_d/. Something is also mounted at /tmp/fuse_a and /tmp/fuse_z.

#!/usr/bin/env python3
import discord
import random
import os
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
def rand_file(path):