Skip to content

Instantly share code, notes, and snippets.

View sorens's full-sized avatar
🍸
😎

Steve Orens sorens

🍸
😎
View GitHub Profile
@tmcw
tmcw / README.md
Last active December 8, 2020 18:53
Icons on the internet

Is there a fully great way to do icons on the internet?


What these are:

  • SVG as IMG: You have an SVG file. Create an img element. SVG is the src of that image element. It's an img tag.
  • Inline SVG: You put an `
@jerblack
jerblack / Elevate when needed in Go.md
Last active April 9, 2024 15:14
Relaunch Windows Golang program with UAC elevation when admin rights needed.

I'm buiding a command line tool in Go that has an option to install itself as a service on Windows, which it needs admin rights for. I wanted to be able to have it reliably detect if it was running as admin already and if not, relaunch itself as admin. When the user runs the tool with the specific switch to trigger this functionality (-install or -uninstall in my case) they are prompted by UAC (User Account Control) to run the program as admin, which allows the tool to relaunch itself with the necessary rights.

To detect if I was admin, I tried the method described here first:
https://coolaj86.com/articles/golang-and-windows-and-admins-oh-my/
This wasn't accurately detecting that I was elevated, and was reporting that I was not elevated even when running the tool in CMD prompt started with "Run as Administrator" so I needed a more reliable method.

I didn't want to try writing to an Admin protected area of the filesystem or registry because Windows has the ability to transparently virtualize those writes

@cliffrowley
cliffrowley / STREAMDECK_HID.md
Last active May 7, 2024 00:09
Notes on the Stream Deck HID protocol

Stream Deck Protocol

How to interface with a Stream Deck device.

Synopsis

The device uses the HID protocol to communicate with its software.

Configuration

@aaronhoffman
aaronhoffman / iphone-text-message-sqlite.sql
Last active February 2, 2024 11:45
SQLite SQL Query for iPhone Text Message Backup
-- more info http://aaron-hoffman.blogspot.com/2017/02/iphone-text-message-sqlite-sql-query.html
select
m.rowid
,coalesce(m.cache_roomnames, h.id) ThreadId
,m.is_from_me IsFromMe
,case when m.is_from_me = 1 then m.account
else h.id end as FromPhoneNumber
,case when m.is_from_me = 0 then m.account
else coalesce(h2.id, h.id) end as ToPhoneNumber
,m.service Service
@fclairamb
fclairamb / get_ppid_and_name.c
Created October 6, 2014 20:30
posix: Get parent process id and name
#ifdef SHELL
gcc -Wall -Werror $0 && ./a.out
exit $?
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
@jnagels
jnagels / AndroidManifest.xml
Created January 6, 2014 10:01
Building with Android Gradle Plugin 0.7.+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<!-- {packagename} will be replaced by the actual packagename -->
<!-- Custom permission to safely send broadcasts between processes -->
<permission
android:name="{packagename}.permission.RECEIVE_BROADCASTS"
android:protectionLevel="signature"/>
@cyrilmottier
cyrilmottier / CityBikesContract.java
Last active January 12, 2024 18:04
Using the new Gradle-based Android build system: a second example
package com.cyrilmottier.android.citybikes.provider;
import android.net.Uri;
import com.cyrilmottier.android.avelov.BuildConfig;
/**
* @author Cyril Mottier
*/
public class CityBikesContract {
@rxaviers
rxaviers / gist:7360908
Last active May 9, 2024 15:35
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@adamgit
adamgit / .gitignore
Last active April 8, 2024 12:58
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#