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 offeneregister_network.py
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
lucahammer / cells-to-rgb.gs
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)
View cells-to-rgb.gs
// 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
lucahammer / mastodon-hashtag-network.py
Last active Aug 30, 2018
Python script to generate a GDF for Gephi to visualize the Mastodon Hashtag Network https://vis.social/web/statuses/100634263439065513
View mastodon-hashtag-network.py
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 = ["mstdn.jp","pawoo.net","friends.nico","mastodon.social","mimumedon.com"] #instances you want to examine
def get_local_timeline(instance_url, count=80):
View fediverse-to-gdf.py
'''
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
lucahammer / fbcomment2clipboard.js
Created Aug 9, 2018
Copy first names of all visible users to clipboard
View fbcomment2clipboard.js
javascript:(function()%7B%2F*https%3A%2F%2Fhackernoon.com%2Fcopying-text-to-clipboard-with-javascript-df4d4988697f*%2Fconst%20copyToClipboard%20%3D%20str%20%3D%3E%20%7Bconst%20el%20%3D%20document.createElement('textarea')%3Bel.value%20%3D%20str%3Bel.setAttribute('readonly'%2C%20'')%3Bel.style.position%20%3D%20'absolute'%3Bel.style.left%20%3D%20'-9999px'%3Bdocument.body.appendChild(el)%3Bel.select()%3Bdocument.execCommand('copy')%3Bdocument.body.removeChild(el)%3B%7D%3Bvar%20names%20%3D%20%5B%5D%3B%20for%20(var%20item%20of%20document.querySelectorAll(%22.UFICommentActorName%22))%7Bnames.push(item.innerText.split(%22%20%22)%5B0%5D)%7D%3BcopyToClipboard(names.join('%2C'))%7D)()
javascript:(function(){
/*https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f*/
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
@lucahammer
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: https://stackoverflow.com/questions/5046972/copy-text-to-clipboard-from-bookmarklet
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}("");
// Add Proper Quotation Marks
// Adds quotations marks around selected text
// Source https://stackoverflow.com/questions/40584878/how-to-create-a-js-bookmarklet-to-insert-fixed-text-at-cursor-position
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+""+a.value.slice(a.selectionStart,a.selectionEnd)+""+a.value.slice(a.selectionEnd);})(document.activeElement);
@lucahammer
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++) {
friends[i].click();
}
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++) {
delete_links[i].click();
}
//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})();
@lucahammer
lucahammer / mastoviz.py
Last active Aug 27, 2018
Mastodon Network visualization (for use with Gephi)
View mastoviz.py
'''
Replace base_url, access_token and user_id
'''
import requests
base_url = 'https://vis.social/api/v1/'
# https://takahashim.github.io/mastodon-access-token/
access_token = '###'
# which followers to visualize
You can’t perform that action at this time.