Skip to content

Instantly share code, notes, and snippets.

View adcreare's full-sized avatar

David adcreare

View GitHub Profile
@Alfreddd
Alfreddd / open connections (sockets) for process
Created June 20, 2012 17:31
list/count open connections (sockets) for All/certain process
# list open sockets for PID
sudo lsof -p 13264 | egrep 'TCP|UDP'
# count of sockets
sudo lsof -p 13264 | egrep "TCP|UDP" | wc -l
# list the open sockets for all passengers
passenger-status | grep PID | awk '{ print $3}' | xargs -i sudo lsof -p {} | egrep 'TCP|UDP'
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@eferro
eferro / _aws_golang_examples.md
Last active July 21, 2023 09:35
golang aws: examples

AWS Golang SDK examples

@woowa-hsw0
woowa-hsw0 / assume_role.sh
Last active January 11, 2023 11:36
Start AWS CLI Session with MFA Enabled (+Yubikey)
#!/bin/bash
set -eu
umask 0022
if [[ $# -lt 1 ]]; then
echo "Usage: $0 role_name [AWS ACCOUNT NUMBER]" >&2
exit 1
fi

Got Retweets?

Even though Twitter's statuses/retweets API endpoint is limited to the last 100 retweets it is possible to use the search/tweets endpoint to search for the retweets using the text of the tweet. Caveat: This is only possible for tweets that have happened in the last 7 days, which is furthest back Twitter allow you to search for tweets in.

For example here is how you can get the retweets for this tweet and analyze the users in a spreadsheet.

@bzub
bzub / 20180819-crostini_sommelier_fix.md
Last active January 24, 2024 12:15
Fix Crostini Wayland/X (sommelier) service

If you can't get X11 or Wayland GUI Linux apps to start anymore on Chrome OS, try the following.

In the Terminal app, this will show the status of your systemd user services/units:

systemctl --user

If sommelier@0.service and sommelier-x@0.service show a failed status, the following worked for me:

sudo ln -s /opt/google/cros-containers/bin/sommelier.elf /usr/bin/