Skip to content

Instantly share code, notes, and snippets.

View luqman's full-sized avatar

Luqman luqman

View GitHub Profile
@luqman
luqman / ga4.js
Created June 21, 2023 11:55
GA4 Cross Domain Linker
/* Currently no way to manually create cross-domain links like you could with old Google Analytics, not ideal to use private API, very hacky workaround */
let link = document.createElement('a');
link.setAttribute('href', 'https://www.target-domain.com');
link.setAttribute('style', 'display:none;');
document.body.append(link);
link.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
### Keybase proof
I hereby claim:
* I am luqman on github.
* I am luqman (https://keybase.io/luqman) on keybase.
* I have a public key whose fingerprint is 22C8 46B1 03D5 E2DA E654 028D E47B 764B 374B C269
To claim this, I am signing this object:
import Ember from 'ember';
import { safeHtml } from '../helpers/safe-html';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments);
let html = safeHtml('<a href="http://google.com">google</a>');
@luqman
luqman / FibaroUniversalSensor.groovy
Created November 10, 2015 17:02
Fibaro Universal Sensor
metadata {
definition (name: "Fibaro Universal Sensor", namespace: "luqman", author: "luqman") {
capability "Sensor"
command "report"
command "singleSet"
command "singleRemove"
command "multiSet"
command "multiRemove"
fingerprint deviceId: "0x2001", inClusters: "0x30 0x60 0x85 0x8E 0x72 0x70 0x86 0x7A 0xEF 0x2B"
@luqman
luqman / gist:e12285cadb6416cc9286
Created January 13, 2015 13:26
phantomjs dmp
4d44 4d50 93a7 0000 0d00 0000 2000 0000
0000 0000 bd1b b554 0000 0000 0000 0000
0300 0000 8401 0000 c000 0000 0400 0000
0c10 0000 c849 0200 0500 0000 9400 0000
4871 0200 0600 0000 a800 0000 e071 0200
0700 0000 3800 0000 8872 0200 0300 6747
8263 0000 6873 0200 0400 6747 6a03 0000
f0d6 0200 0500 6747 6a00 0000 60da 0200
0600 6747 e200 0000 d0da 0200 0700 6747
b03f 0000 b8db 0200 0800 6747 3001 0000

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

require 'geoip'
module Rack
# Rack::GeoIPCountry uses the geoip gem and the GeoIP database to lookup the country of a request by its IP address
# The database can be downloaded from:
# http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
#
# Usage:
# use Rack::GeoIPCountry, :db => "path/to/GeoIP.dat"
#