Skip to content

Instantly share code, notes, and snippets.

View lukeduncan-scot's full-sized avatar

L Duncan lukeduncan-scot

  • Highlands, Scotland
  • 07:33 (UTC +01:00)
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'
@KartikTalwar
KartikTalwar / Documentation.md
Last active September 2, 2026 11:58
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@pascalpoitras
pascalpoitras / 1.md
Last active August 30, 2026 15:30
My WeeChat configuration

This configuration is no longer updated

@jinyeow
jinyeow / bspwmrc
Last active November 7, 2022 13:30
Config files related to bspwm and panel (lemonbar)
#!/bin/zsh
ws1= # main
ws2= # web
ws3= # mail
ws4= # code
ws5= # math [infinity]  (term icon)
ws6= # media
ws7= # misc  (9 squares icon)
ws8= # notes/docs  (pdf icon)
@joar
joar / jq-insert-var.sh
Last active July 24, 2025 14:46
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@subfuzion
subfuzion / github-wiki-how-to.md
Last active August 16, 2026 19:38
GitHub Wiki How-To

How do I clone a GitHub wiki?

Any GitHub wiki can be cloned by appending wiki.git to the repo url, so the clone url for the repo https://myorg/myrepo/ is: git@github.com:myorg/myrepo.wiki.git (for ssh) or https://github.com/my/myrepo.wiki.git (for https).

You make edits, and commit and push your changes, like any normal repo. This wiki repo is distinct from any clone of the project repo (the repo without wiki.get appended).

How do I add images to a wiki page?

@mugifly
mugifly / adb-android-disable-animation.sh
Last active December 8, 2022 22:40
Disable the animation of Android Virtual Device using adb command
# For Android JellyBean and newer device
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="window_animation_scale"'
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="transition_animation_scale"'
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="animator_duration_scale"'
# For Android ICS and older device
adb shell "echo \"update system set value=0.0 where name='window_animation_scale';\" | sqlite3 /data/data/com.android.providers.settings/databases/settings.db"
adb shell "echo \"update system set value=0.0 where name='transition_animation_scale';\" | sqlite3 /data/data/com.android.providers.settings/databases/settings.db"
package test.iamjonfry.com.interceptortest;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import java.io.File;
import java.io.IOException;
import java.util.List;
import okhttp3.Cache;
@joyrexus
joyrexus / README.md
Last active June 9, 2026 04:07
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@ramiloif
ramiloif / fakeCall.sh
Last active August 19, 2020 04:07
Make the broadcast receiver to receive a missed or answered call
phoneNumber=$1
echo Faking answered call to $phoneNumber
adb shell am broadcast -a android.intent.action.PHONE_STATE --es state "RINGING" --es incoming_number $phoneNumber
adb shell am broadcast -a android.intent.action.PHONE_STATE --es state "OFFHOOK" --es incoming_number $phoneNumber
adb shell am broadcast -a android.intent.action.PHONE_STATE --es state "IDLE" --es incoming_number $phoneNumber