Skip to content

Instantly share code, notes, and snippets.

View hericah's full-sized avatar
🎯
Focusing

Heri hericah

🎯
Focusing
View GitHub Profile
@hikoz
hikoz / dd.py
Created December 15, 2010 04:45
dd with progress in python
#!/usr/bin/env python
import sys
import time
import signal
from subprocess import Popen, PIPE
dd = Popen(['dd'] + sys.argv[1:], stderr=PIPE)
while dd.poll() is None:
time.sleep(.3)
dd.send_signal(signal.SIGUSR1)
@funkatron
funkatron / http_digest_example.php
Created April 30, 2011 20:08
An example of how to manually construct an HTTP Digest authentication header.
<?php
$url = 'http://domain.foo';
$uri = '/assets';
$username = 'testyser';
$password = 'somepassword';
$method = 'GET';
$ht = new HttpRequest($url.$uri, HttpRequest::METH_GET);
$ht->send();
@slowkow
slowkow / ssh-tutorial.md
Last active May 4, 2024 13:52
ssh to a server without typing your password

How to ssh to a remote server without typing your password

Save yourself a few keystrokes. Follow the steps below:

  1. Run this Bash script on your laptop:

    #!/usr/bin/env bash
    

The hostname of your remote server.

@cevaris
cevaris / generate_key.sh
Last active May 5, 2024 19:34
Sign and Verify using Python pycrypto
#!/usr/bin/env bash
# Generate RSA private key
openssl genrsa -out private_key.pem 1024
@pudquick
pudquick / parse_pbzx.py
Last active September 27, 2021 04:34
Pure python reimplementation of .cpio.xz content extraction from pbzx file payload for OS X packages
# Pure python reimplementation of .cpio.xz content extraction from pbzx file payload originally here:
# http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html
#
# Cleaned up C version (as the basis for my code) here, thanks to Pepijn Bruienne / @bruienne
# https://gist.github.com/bruienne/029494bbcfb358098b41
# Example usage:
# parse_pbzx('PayloadJava', 'PayloadJava.cpio.xz')
# Updated for speeeeeeeeeeeeed
@frafra
frafra / 05-batman
Last active June 17, 2024 14:16
NetworkManager integration with batman-adv
#!/bin/sh
#
# /etc/NetworkManager/dispatcher.d/05-batman
ESSID="Igloo mesh"
IFACE="wlp2s0"
ADDR="01:23:45:67:89:AB"
function current {
nmcli -t -f GENERAL.CONNECTION d show $IFACE | cut -d\: -f2
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active July 23, 2024 22:30
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@bashtoni
bashtoni / gist:995c0683bb18fd19eaefdc296a9401d8
Created July 4, 2018 10:48
Find ARN for ACM certificate for a given domain name
aws acm us-east-1 list-certificates --query CertificateSummaryList[].[CertificateArn,DomainName] \
--output text | grep example.com | cut -f1
@aursu
aursu / modem.py
Last active June 7, 2024 19:27
ModemManager interface via Python 3 (Dbus, Modems, SMS)
#!/usr/bin/python3
# script created for reading SMS messages from 3G modem connected to PC
# 1) it looks for modem
# 2) reads all SMS messages from modem
# 3) prints all found SMS messages to stdout only if total messages count
# greater than SMS_STORE_COUNT (default is 3)
# 4) save all but SMS_STORE_COUNT messages to txt files and
# delete them from modem
@parrotmac
parrotmac / dbus-send-modem-command.sh
Created November 15, 2018 08:14
Send serial command to modem using ModemManager via DBus
#!/bin/sh
# Sends command 'ATI' to modem #3
# Get a list of modems by running `mmcli -L`
# Timeout is (probably) 2 seconds
# Also see https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Modem.html#gdbus-method-org-freedesktop-ModemManager1-Modem.Command
dbus-send --system --dest=org.freedesktop.ModemManager1 --print-reply /org/freedesktop/ModemManager1/Modem/3 org.freedesktop.ModemManager1.Modem.Command string:'ATI' uint32:2000