Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
hmm!

Mohammad Shahgolzadeh m2sh

🤔
hmm!
View GitHub Profile
@arastu
arastu / current_track.applescript
Last active Nov 27, 2020
update twitter bio and add current playing song from Spotify to it
View current_track.applescript
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"
@muuvmuuv
muuvmuuv / nginx-brotli.Dockerfile
Last active Jun 10, 2021
Dockerfile which compiles brotli from source
View nginx-brotli.Dockerfile
ARG version
ARG timezone=Europe/Berlin
ARG modules_dir="/usr/lib/nginx/modules"
################################################################
# BUILDER
#
# Compile brotli and zstd from source to use it in a standard
# NGINX image container.
@LupusArgentum
LupusArgentum / openwrt-8021x.md
Last active Dec 8, 2020
OpenWrt-router as 802.1x-client
View openwrt-8021x.md

OpenWrt-router as 802.1x-client

This use-case is a pretty rare one, but in some circumstances, it can be very helpful. For example when you live in a student dormatory which only offers one 802.1x-encrypted LAN-port in your room, but you want to run your own wifi-network to be online with other clients, too, like your laptop or smartphone. In this case, normal routers with stock firmware won't help you out because most don't support this networking protocol. OpenWrt on the other hand offers you the possibility to connect your router (you could buy this one if you don't already have a suiting router) to the 802.1x-network via WAN and enable you to have an own, independent network. Here's how.

Important: before you attempt to do this, it is NECESSARY to ask your network admin if he/she is okay with your usage scenario. This can cause some trouble if you do it without permission, as many 802.1x-networks aim to prevent this exact use-case.

So here's the deal

View mongodb_cheat_sheet.md

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@mcfrojd
mcfrojd / Shield_Intents.MD
Last active Jun 22, 2021
Working INTENTS to use with Community Hass.io Add-ons: Android Debug Bridge for your Nvidia Shield TV
View Shield_Intents.MD

Latest Update 2021-03-06 : New image showing the new "Services" in Home Assistant and got some tips from the comments below.

Credits and thanks: Home Assistant Forum users & Github users: @ocso, @wiphye, @teachingbirds, @tboyce1, @simbesh, @JeffLIrion @ff12 @rebmemer @siaox @DiederikvandenB @Thebuz @clapbr @Finsterclown


Start apps on your android device (in the examples below, my Nvidia Shield TV) from Home Assistant

alt text

Starts Youtube App

entity_id: media_player.shield
command: >-
@numb95
numb95 / route-all-traffic-through-tor.md
Last active Feb 7, 2021
Route all internet traffic through Tor
View route-all-traffic-through-tor.md

Do not use in production Server or if you don't know what iptables do

Add this to torrc ( located on /etc/tor/torrc):

VirtualAddrNetwork 10.192.0.0/10

AutomapHostsOnResolve 1

TransPort 9051 
@amrza
amrza / private-access.java
Last active Feb 26, 2018
Objects of the same type will have access to each others private and protected members even though they are not the same instances! WTF!
View private-access.java
// Person.class
//-------------------------
class Person {
private String name;
public Person(String name) {
this.name = name;
}
View proxy-switcher.sh
# using:
# for set proxy:
# $ setproxy 127.0.0.1 8118
# for unset:
# $ unsetproxy
function setproxy() {
export {http,https,ftp,HTTP,HTTPS}_proxy=http://$1:$2
export no_proxy="localhost,127.0.0.1,master.cafecluster"
echo "Proxy variable(http,https,ftp) set to $1:$2"
@pkern
pkern / Makefile
Last active Oct 28, 2020
OpenWRT package for sniproxy
View Makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=sniproxy
PKG_VERSION:=0.6.0
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/dlundquist/sniproxy/archive/
PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_MD5SUM:=bcfb5d1efe045b8b356a4229f2339f02
@gaquino
gaquino / gist:87bdf0e6e852e445c0489379d3e9732a
Last active May 10, 2021
MacOS (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools))
View gist:87bdf0e6e852e445c0489379d3e9732a
If you are facing an error like that on new MacOS version.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
It means that you need to install XCode command line, open a Terminal and run this command:
$ xcode-select --install
Note:
If you want to download and install Command Line tools manually, it can be downloaded from: https://developer.apple.com/download/more/