Skip to content

Instantly share code, notes, and snippets.

View marcg1968's full-sized avatar

Marc Greyling marcg1968

View GitHub Profile
@marcg1968
marcg1968 / gist:e1357e71eca8074bcfe6d450624b18ee
Last active January 24, 2024 03:42
common_setup_desktop.sh
#!/usr/bin/env bash
# run as root
#
# GIST_URL="https://gist.githubusercontent.com/marcg1968/e1357e71eca8074bcfe6d450624b18ee/raw/3de0c0701a3e504d588763dea998667f1d582b47/gistfile1.txt"
# wget -O - "$GIST_URL" | bash
[ $(id -u) == "0" ] || { sudo "$0" "$@"; exit $?; }
USR="marc"
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
sudo apt update && \
sudo dpkg -i "/tmp/"google-chrome-stable_current_amd64.deb && \
sudo apt-get install -f
cd -
URL="https://www.dropbox.com/s/sgwpa3mez110965/common_setup_desktop.sh?dl=1"
sudo su -c "bash <(wget -qO- "$URL")" root
@marcg1968
marcg1968 / rndcol.md
Created August 27, 2021 07:26
Javascript: random colour
const randomHexCol = () => '#' + (0x1000000 + Math.random() * 0xffffff).toString(16).slice(1, 6);
randomHexCol()
randomHexCol() // #abea67
@marcg1968
marcg1968 / Menu.js
Created February 12, 2021 23:47
Example implementation of React Redux with lunr for searching
// Menu.js
import React from 'react';
import lunr from 'lunr';
import store from "../redux/store";
import { connect } from "react-redux";
/* this is exported for redux and needs to be imported as follows:
* import StaticMenu from './Menu';
*/
@marcg1968
marcg1968 / REFech.md
Last active April 23, 2018 18:17
Real estate Fechenheim

Fechenheim Immobilienmakler:

Goldstein:

20180423_132238

S-Immobilien, Frankfurter-Sparkasse 1822:

20180423_132320

@marcg1968
marcg1968 / base36.py
Created August 31, 2015 09:37
Python convert (encode/decode) base 36
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://stackoverflow.com/a/1181922
def base36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Converts an integer to a base36 string."""
if not isinstance(number, (int, long)):
raise TypeError('number must be an integer')