Skip to content

Instantly share code, notes, and snippets.

@llbbl
llbbl / fix_openssl_catalina.sh
Last active November 3, 2023 06:05
fix missing openssl files in catalina
#!/bin/bash
echo 'update brew'
brew update
echo 'upgrade brew'
brew upgrade
@emxsys
emxsys / raspberry_pi_script_as_service.md
Last active April 6, 2024 13:46
How to run a python script as a service in Raspberry Pi - Raspbian Jessie

How to Run a Script as a Service in Raspberry Pi - Raspbian Jessie

By: Diego Acuña

Original Article: http://www.diegoacuna.me/how-to-run-a-script-as-a-service-in-raspberry-pi-raspbian-jessie/

A pretty common task when using this device, is to run some script (for example a python script) as a service in the operating system so it can start on boot, stop and restart using systemctl and more. In this post I'm going to explain how to set a little script as a service using Raspbian Jessie in a Raspberry Pi.

Example Python Script

@sammchardy
sammchardy / binance_get_historical_klines.py
Last active May 13, 2023 22:12
Get historical Klines from Binance
# uses the date_to_milliseconds and interval_to_milliseconds functions
# https://gist.github.com/sammchardy/3547cfab1faf78e385b3fcb83ad86395
# https://gist.github.com/sammchardy/fcbb2b836d1f694f39bddd569d1c16fe
from binance.client import Client
import time
def get_historical_klines(symbol, interval, start_str, end_str=None):
"""Get Historical Klines from Binance

Introduction

Sometimes you may want to use a DNS server for specific domain requests and another DNS server for all other requests. This is helpful, for instance, when connected to a VPN. For hosts behind that VPN you want to use the VPN's DNS server but all other hosts you want to use Google's public DNS. This is called "DNS splitting."

Here, we run dnsmasq as a background service on macOS. The dnsmasq configuration described below implements DNS splitting.

Install

brew install dnsmasq
@diffficult
diffficult / WD_My_Cloud_EX2.txt
Created April 16, 2017 07:42
Fan control notes for WD My Cloud EX2 Ultra
~ # fan_control -?
*** Fan Cobtrol Help Message ***
fan_control b c: for NAS booting
fan_control 0 d : [auto: low/medium/high/max] open debug msg
fan_control 0 c : [auto: low/medium/high/max] close debug msg
fan_control -L [value] : set Lower (THYST)
fan_control -H [value] : set Upper(TOS)
fan_control -g 0 : get current temperature
fan_control -g 1 : get Lower temperature
fan_control -g 2 : get Upper temperature
#!/usr/bin/env python2
"""picofix.py: reboot the a router when it fails to contact a distant node."""
__author__ = "Alex 'Chozabu' P-B"
import pyping
from time import sleep
from datetime import datetime
@samarthbhargav
samarthbhargav / scrape_xkcd.py
Last active December 12, 2017 15:57
XKCD Scraper - using BeautifulSoup and requests
from bs4 import BeautifulSoup
import requests
import shutil
import glob
from os import listdir
from os.path import isfile, join
def save_image(url, filename):
response = requests.get(url, stream=True)
@dalhundal
dalhundal / reboot-dg834g.sh
Created May 4, 2014 16:54
Script to reboot Netgear DG834G router
#!/bin/sh
# Script to reboot netgear DG834G router
# Tried this only on v5, may work on others.
IP=192.168.1.1
USER=admin
PASSWORD=password
curl --user $USER:$PASSWORD $IP/reboot.cgi >/dev/null 2>&1