Skip to content

Instantly share code, notes, and snippets.

Giacomo Stelluti Scala gsscoder

Block or report user

Report or block gsscoder

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
@gsscoder
gsscoder / alive.go
Created Dec 14, 2019
Go goroutine and channel to monitor process end
View alive.go
// usage: ./main [PROCESS-ID]
package main
import (
"fmt"
"time"
"os"
"strconv"
"github.com/shirou/gopsutil/process"
)
@gsscoder
gsscoder / endless.go
Created Dec 13, 2019
Infinity loop written in Go to check CPU usage
View endless.go
package main
import (
"fmt"
"time"
)
func main() {
ms, _ := time.ParseDuration("10ms")
for {
@gsscoder
gsscoder / ProcessEnd.cs
Created Dec 13, 2019
Demonstrates how to detect end of a running process
View ProcessEnd.cs
// purpose: detect process end
// demo:
// - launch firefox
// - launch this program
// - close firefox and see 'died'
// notes:
// - may need sudo on *nix systems
using System;
using System.Diagnostics;
View settings_vscode.json
{
"terminal.integrated.rendererType": "dom",
"python.pythonPath": "/usr/local/opt/python/bin/python3.7",
"window.zoomLevel": 0,
"workbench.startupEditor": "none",
"[python]": {
"editor.rulers": [
72, 79
],
@gsscoder
gsscoder / toggle_codelens.json
Created Dec 6, 2019
Settings to switch codeLens on/off with toggle
View toggle_codelens.json
// extension: marketplace.visualstudio.com/items?itemName=rebornix.toggle
// usage: add to keybindings.json
[
{
"key": "cmd+alt+l",
"command": "toggle",
"when": "editorTextFocus",
"args": {
"id": "codeLens",
"value": [
@gsscoder
gsscoder / dynamic.py
Last active Dec 6, 2019
Dynamic calls in Python
View dynamic.py
import sys
def say_something(text):
print(f'I say: {text}...')
class simple:
def hello(self, text):
print(f'Hello, {text}!')
@staticmethod
def hello_again(text):
@gsscoder
gsscoder / vscode_terminal.json
Created Nov 28, 2019
Settings to customize terminal of VSCode
View vscode_terminal.json
{
"terminal.integrated.fontFamily": "Monaco",
"terminal.integrated.fontSize": 12,
"terminal.integrated.lineHeight":1
}
@gsscoder
gsscoder / wordify.py
Created Nov 23, 2019
Python function to split into words ignoring punctuation
View wordify.py
import re
def wordify(text):
words = []
matches = re.findall(r'(\b[^\s]+\b)', text)
if matches:
for word in matches:
words.append(word)
return words
@gsscoder
gsscoder / fbscrap_getIDs.py
Last active Nov 23, 2019
Scrapes Facebook to gather profile IDs
View fbscrap_getIDs.py
"""
fbscrap_getIDs.py:
Used to gather real Facebook profile IDs (https://github.com/gsscoder/facebook-snooper/).
For version: 0.4.3
Usage: python3 fbscrap_getIDs output_file.txt
"""
import requests
import json
import sys
@gsscoder
gsscoder / fbscrap_5random-2.py
Last active Nov 23, 2019
Scrapes Facebook for 5 random persons in 5 random cities (2)
View fbscrap_5random-2.py
"""
fbscrap_5random-2.py:
Demonstrates facebook_snooper package (https://github.com/gsscoder/facebook-snooper/).
For version: 0.4.3
Usage: python3 fbscrap_5random-2
"""
import requests
import json
import sys
You can’t perform that action at this time.