Skip to content

Instantly share code, notes, and snippets.

Cleaning code.

Luca Hammer lucahammer

Cleaning code.
Block or report user

Report or block lucahammer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View raspi pi notes
import json_lines
import pprint
pp = pprint.PrettyPrinter(indent=1)
def get_companies(line_number=0,lines=1):
Returns as many companies as you want as a list.
The higher the starting line, the longer it takes.
lucahammer /
Last active Sep 22, 2018
Google script to change the background of a cell based on HSL values in other cells. (Select three cells with H, S and L values and click the Button under Custom in the menu)
// Change this to the column numbers of your HSL values
// A == 1, B == 2,...
var hColumn = 5;
var sColumn = 6;
var lColumn = 7;
var ui = SpreadsheetApp.getUi();
var sheet = SpreadsheetApp.getActiveSheet();
// setup Buttons
lucahammer /
Last active Aug 30, 2018
Python script to generate a GDF for Gephi to visualize the Mastodon Hashtag Network
from multiprocessing import Pool
import requests
import datetime
import time
MAX_PROCESSES = 100 #number of python processes that can run in parallel
TOOTS_PER_INSTANCE = 4000 #multiples of 40
MASTOVERSE = ["","","","",""] #instances you want to examine
def get_local_timeline(instance_url, count=80):
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
lucahammer / fbcomment2clipboard.js
Created Aug 9, 2018
Copy first names of all visible users to clipboard
View fbcomment2clipboard.js
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
el.setAttribute('readonly', ''); = 'absolute'; = '-9999px';
lucahammer / typomarklets.js
Last active Apr 3, 2018
Typo Bookmarklets
View typomarklets.js
// Copy a zero width whitespace to the clipboard
// Adds a element to the document, selects it, adds it to the clipboard and removes it
// Source:
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),,document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}("");
// Add Proper Quotation Marks
// Adds quotations marks around selected text
// Source
lucahammer / contacts-to-list.js
Created Mar 30, 2018
add all Facebook contacts to a list
View contacts-to-list.js
// Create new List
// Choose Manage List -> Edit List
// Scroll to bottom of friends.
// Execute code
var friends = document.querySelectorAll('.friendListItem');
for (var i = 0; i < friends.length; i++) {
View remove_apps.js
// collect all links to remove the apps
var delete_links = document.querySelectorAll('#delete-link');
//click all collected links
for (var i = 0; i < delete_links.length; i++) {
//wait five seconds for the confirmation boxes to load
//and click all confirmation boxes to remove the apps
View gist:7e43d5a39ae8344e905ba4f2690f2cca
Play the first html video faster (eg. on Facebook): javascript:(function(){document.getElementsByTagName('video')[0].playbackRate += 0.5})();
Play the first html video slower: javascript:(function(){document.getElementsByTagName('video')[0].playbackRate -= 0.5})();
You can’t perform that action at this time.