Skip to content

Instantly share code, notes, and snippets.

View georgkreimer's full-sized avatar
☠️
Hack the planet!

Georg Kreimer georgkreimer

☠️
Hack the planet!
View GitHub Profile
@georgkreimer
georgkreimer / gist:577d89fb7e31caccf291587ab2c8a2e6
Created January 12, 2024 11:36
Reset all macOS display resolution in case ext. monitor doesnt turn on spontaneously or you effed up your settings
- delete files:
~/Library/Preferences/ByHost/com.apple.windowserver.displays.{ Some HEX string}.plist
/Library/Preferences/com.apple.windowserver.displays.plist
- reboot.
@georgkreimer
georgkreimer / gist:e5033a1a5c2e735c020463cc0a75bb20
Created September 26, 2023 18:46
Commonly Whitelisted Domains - pi-hole community
pihole -w clients4.google.com
pihole -w clients2.google.com
pihole -w s.youtube.com
pihole -w video-stats.l.google.com
pihole -w www.googleapis.com
pihole -w youtubei.googleapis.com
pihole -w oauthaccountmanager.googleapis.com
pihole -w android.clients.google.com
pihole -w reminders-pa.googleapis.com firestore.googleapis.com
pihole -w gstaticadssl.l.google.com

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
@georgkreimer
georgkreimer / gist:537794
Created August 19, 2010 12:44
pretty print json in ruby
require 'json'
my_json = { :array => [1, 2, 3, { :sample => "hash"} ], :foo => "bar" }
puts JSON.pretty_generate(my_json)
Which gets you...
{
"array": [
1,
2,
3,
Verifying my Blockstack ID is secured with the address 1CZSuabhhT3A5Nf6qjawHJCtvYxuct4zoE https://explorer.blockstack.org/address/1CZSuabhhT3A5Nf6qjawHJCtvYxuct4zoE
@georgkreimer
georgkreimer / gist:7a02af49604da91c5e3605b08b2872ec
Created May 15, 2017 20:28
UFW config w/ NBD connections
https://community.online.net/t/enable-ufw-in-debian-or-ubuntu-results-in-lock-out/2118/2
Set the default INPUT policy to ACCEPT: Edit /etc/default/ufw and set:
DEFAULT_INPUT_POLICY="ACCEPT"
Append a drop-all rule to the INPUT chain: Edit /etc/ufw/after.rules, add this line just before the final COMMIT line:
-A ufw-reject-input -j DROP
Disable UFW logging (this seems to cause issuses with Scaleway's default kernel):
ufw logging off
# extensions
# …
module SOAPArray
def to_soap_array(item_name = "messageId")
result=Array.new
self.each do |val|
result.push({item_name => val.to_i})
end
result
end
@georgkreimer
georgkreimer / hash_intersection.rb
Created November 19, 2010 14:07
Hash intersection in Ruby
first = {"a" => 4, "b" => 1, "c" => 3, "g" => 201, "h" => 501}
second = {"d" => 19, "e" => 18, "c" => 17, "g" => 201, "h" => 501}
keys_intersection = first.keys & second.keys
merged = first.dup.update(second)
intersection = {}
keys_intersection.each do |k|
intersection[k]=merged[k] unless first[k] != second[k]
end
@georgkreimer
georgkreimer / point_in_polygon.rb
Created September 17, 2010 21:34
tests if a point is inside a polygon (ported code from c example)
polygon = [{:x=>0,:y=>0},{:x=>4,:y=>0},{:x=>2,:y=>2},{:x=>0,:y=>4}]
point0 = {:x=>0,:y=>0}
point1 = {:x=>0.00000000001,:y=>0.00000000001}
point2 = {:x=>1,:y=>1}
point3 = {:x=>2,:y=>2}
point4 = {:x=>1.99999999999,:y=>1.99999999999}
# http://www.visibone.com/inpoly/
# http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
#
@georgkreimer
georgkreimer / readme
Created May 15, 2017 21:04
UFW config changes for NBD connections
Set the default INPUT policy to ACCEPT: Edit /etc/default/ufw and set:
DEFAULT_INPUT_POLICY="ACCEPT"
Append a drop-all rule to the INPUT chain: Edit /etc/ufw/after.rules, add this line just before the final COMMIT line:
-A ufw-reject-input -j DROP
Disable UFW logging (this seems to cause issuses with Scaleway's default kernel):
ufw logging off
Enable UFW (don't forget to allow SSH traffic):