Skip to content

Instantly share code, notes, and snippets.

View cnmoro's full-sized avatar
🎯
Focusing

Carlo Moro cnmoro

🎯
Focusing
View GitHub Profile
@mlocati
mlocati / color-scale.js
Last active May 1, 2024 10:55
Javascript color scale from 0% to 100%, rendering it from red to yellow to green
// License: MIT - https://opensource.org/licenses/MIT
// Author: Michele Locati <michele@locati.it>
// Source: https://gist.github.com/mlocati/7210513
function perc2color(perc) {
var r, g, b = 0;
if(perc < 50) {
r = 255;
g = Math.round(5.1 * perc);
}
else {
@cbarraco
cbarraco / ffmpeg screen sharing
Last active December 24, 2023 09:46
The poor man's VNC. If you have ffmpeg and netcat you can stream your screen across your network with two one-liners
# If the server has ffmpeg:
## For the server:
ffmpeg -f fbdev -i /dev/fb0 -f avi pipe:1 | nc -l -p 1234
## For the viewer:
nc 127.0.0.1 1234 | ffplay -i pipe:0
# If the server doesn't have ffmpeg:
## For the server:
sudo cat /dev/fb0 | nc -l -p 1234
## For the viewer (replace 1920x1080 with the server's resolution):
@mangoliou
mangoliou / x11vnc-stack-smashing-detected-solution.mk
Last active June 1, 2023 06:49
x11vnc `stack smashing detected` solution.
# Install x-related to compile x11vnc from source code.
sudo apt-get update
sudo apt-get install -y libxtst-dev libssl-dev libjpeg-dev
# Grep source code.
wget http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz
gzip -dc x11vnc-0.9.14-dev.tar.gz | tar -xvf -
cd x11vnc-0.9.14/
./configure --prefix=/usr/local CFLAGS='-g -O2 -fno-stack-protector -Wall'
@shanealynn
shanealynn / python batch geocoding.py
Last active January 6, 2024 13:48
Geocode as many addresses as you'd like with a powerful Python and Google Geocoding API combination
"""
Python script for batch geocoding of addresses using the Google Geocoding API.
This script allows for massive lists of addresses to be geocoded for free by pausing when the
geocoder hits the free rate limit set by Google (2500 per day). If you have an API key for paid
geocoding from Google, set it in the API key section.
Addresses for geocoding can be specified in a list of strings "addresses". In this script, addresses
come from a csv file with a column "Address". Adjust the code to your own requirements as needed.
After every 500 successul geocode operations, a temporary file with results is recorded in case of
script failure / loss of connection later.
Addresses and data are held in memory, so this script may need to be adjusted to process files line
@tomquisel
tomquisel / prefit_voting_classifier.py
Last active March 15, 2022 20:45
Version of scikit-learn's VotingClassifier that uses prefit models rather than requiring a refit.
class VotingClassifier(object):
"""Stripped-down version of VotingClassifier that uses prefit estimators"""
def __init__(self, estimators, voting='hard', weights=None):
self.estimators = [e[1] for e in estimators]
self.named_estimators = dict(estimators)
self.voting = voting
self.weights = weights
def fit(self, X, y, sample_weight=None):
raise NotImplementedError
@joshschmelzle
joshschmelzle / remove-gamebar-powershell-win10.md
Last active June 3, 2024 19:10
How to Remove the Xbox Game Bar with Powershell on Windows 10

You've probably stumbled upon this researching how to remove the Xbox Game Bar. This gist includes a few different methods you can try. Please note that some of these first options are probably not be available unless you are running an older version of Windows 10.

Uninstalling/Removing the Game Bar (old Windows 10 build GUI options)

(this is no longer an option on any recent Windows 10 build)

  1. Press Windows Key or click on the Start menu.
  2. Start typing Xbox or Game Bar, until you get the Xbox Game Bar app to appear in the results.
  3. Right-click on the app and pick Uninstall. Answer Yes to the prompt, and wait for the process to finish.
@kylemcdonald
kylemcdonald / matplotlib Border Removal.ipynb
Last active January 29, 2024 18:35
How to (mostly) remove all borders and padding with matplotlib.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tamnil
tamnil / ceps.csv
Created March 19, 2018 16:40 — forked from hugosenari/ceps.csv
Faixas de CEPs
UF CIDADE CEP DE CEP ATÉ
AC 69900000 69999999
AC Acrelândia 69945000 69949999
AC Assis Brasil 69935000 69939999
AC Brasiléia 69932000 69933999
AC Bujari 69926000 69926999
AC Capixaba 69931000 69931999
AC Cruzeiro do Sul 69980000 69981999
AC Epitaciolândia 69934000 69934999
AC Feijó 69960000 69969999
@felipou
felipou / decrypt_dbeaver.py
Last active January 24, 2024 14:11
DBeaver password decryption script
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
import sys
import base64
print(sys.argv[1])
PASSWORD_ENCRYPTION_KEY = b"sdf@!#$verf^wv%6Fwe%$$#FFGwfsdefwfe135s$^H)dg"
@bmaupin
bmaupin / install-oracle-client-ubuntu.md
Last active February 2, 2024 04:38
Install Oracle client on Ubuntu

Reference: https://help.ubuntu.com/community/Oracle%20Instant%20Client

Tested on: Ubuntu 18.04, 20.04

  1. Decide which version of the Oracle client to install

  2. Download the Oracle client packages